关于wifi AP模式(热点Hotpot) ip地址的相关信息
2014-12-21 13:14
441 查看
/frameworks/base/services/java/com/android/server/connectivity/Tethering.java
/frameworks/base/wifi/java/android/net/wifi/WifiStateMachine.java
In the Tethering.java,
[code]private static final String USB_NEAR_IFACE_ADDR = "192.168.42.129"; private static final int USB_PREFIX_LENGTH = 24; // USB is 192.168.42.1 and 255.255.255.0 // Wifi is 192.168.43.1 and 255.255.255.0 // BT is limited to max default of 5 connections. 192.168.44.1 to 192.168.48.1 // with 255.255.255.0 原文出处 stackoverflow.com/questions/17302220/android-get-ip-address-of-a-hotspot-providing-device private String[] mDhcpRange; private static final String[] DHCP_DEFAULT_RANGE = { "192.168.42.2", "192.168.42.254", "192.168.43.2", "192.168.43.254", "192.168.44.2", "192.168.44.254", "192.168.45.2", "192.168.45.254", "192.168.46.2", "192.168.46.254", "192.168.47.2", "192.168.47.254", "192.168.48.2", "192.168.48.254", };
Also, in the WifiStateMachine.java
[code]private boolean startTethering(ArrayList<String> available) { boolean wifiAvailable = false; checkAndSetConnectivityInstance(); String[] wifiRegexs = mCm.getTetherableWifiRegexs(); for (String intf : available) { for (String regex : wifiRegexs) { if (intf.matches(regex)) { InterfaceConfiguration ifcg = null; try { ifcg = mNwService.getInterfaceConfig(intf); if (ifcg != null) { /* IP/netmask: 192.168.43.1/255.255.255.0 */ ifcg.setLinkAddress(new LinkAddress( NetworkUtils.numericToInetAddress("192.168.43.1"), 24)); ifcg.setInterfaceUp(); mNwService.setInterfaceConfig(intf, ifcg); } } catch (Exception e) { loge("Error configuring interface " + intf + ", :" + e); return false; } if(mCm.tether(intf) != ConnectivityManager.TETHER_ERROR_NO_ERROR) { loge("Error tethering on " + intf); return false; } mTetherInterfaceName = intf; return true; } } } // We found no interfaces to tether return false; }
Therefore, the default value is
192.168.43.1.
相关文章推荐
- 关于wifi启动是获取相关信息
- wifi的ap模式下获取热点(popen,fgets,printf,iwpriv)
- Android系统信息获取 之十四:获取WIFI热点相关信息
- 关于WIFI的工作模式--AP MODE/STATION MODE
- Android系统信息获取 之十四:获取WIFI热点相关信息
- 树莓派学习笔记——Wifi AP热点模式 使用RT5370
- 关于获取android的wifi-ip地址
- 怎样用笔记本的无线网卡做一个AP 实现笔记本做wifi热点供手机、平板电脑wifi上网而不用无线路由器
- 关于位置——CSSOM视图模式(CSSOM View Module)相关整理
- 关于数学中的正弦定理和余弦定理的相关信息的概述
- 关于多网卡读取IP相关信息
- xp下如何用无线网卡做ap wifi热点。手机连电脑wifi上网
- 关于主线程获取线程结束相关信息 (c++ builder)
- wifi的相关信息
- struts1中关于ActionForm的相关信息
- 关于在jsp页面写java代码的分析(限定用户查看相关的信息)
- 关于520硬盘的相关信息--数据恢复必备知识
- 关于间皮瘤mesothelioma的相关信息
- ubuntu共享wifi(AP)给安卓(Android)手机,如何查看ubuntu无线网卡是否支持AP(master )模式
- 关于信息查询和相关的数据库操作语句的写法