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