3
我有一个应用程序,应用程序连接两个电话使用热点发送/ recv文件。 One手机创建热点(Wifi热点),我用下面的代码连接其他热点电话:连接wifi热点电话错误:ENETUNREACH
mSocket = new Socket();
try {
mSocket.setReuseAddress(true);
mSocket.bind(null);
mSocket.setPerformancePreferences(0, 1, 2);
mSocket.setTcpNoDelay(true);
mSocket.setSoLinger(true, 0);
mSocket.setKeepAlive(true);
mSocket.connect(new InetSocketAddress(mConnection.getServerAddress(),
mConnection.getServerPort()), SOCKET_CONNECT_TIMEOUT);
//operation here....
} catch (SocketException e) {
((HotSpotConnection)mConnection).getlocalip();
LogUtils.LOGE(LOG_TAG, "init exception:" + e.toString());
} catch (IOException e) {
LogUtils.LOGE(LOG_TAG, "init exception:" + e.toString());
}
,我得到了下面的错误:
E/MyTestWifiThread(18918): init exception:java.net.ConnectException:
failed to connect to /192.168.43.1 (port 9876) after 30000ms:
isConnected failed: ENETUNREACH (Network is unreachable)
为什么不能连接到热点的手机,我确定热点电话地址默认为192.168.43.1?因为我已经ping了192.168.43.1并且热点电话回复了。
今天我得到了同样的问题。这个问题的任何推荐调试方法? – gladman 2014-12-04 11:04:22