0
我在這裏有一點麻煩,一方面我有一個服務器偵聽端口23000,另一方面作爲客戶端的Android應用程序。雖然連接似乎在模擬器中工作(這是順便建立的2.3.3),使用典型的10.2 .... IP,嘗試三星Galaxy Tab時,我一直在着名:地址系列不支持真正的Android設備上的協議例外
「地址家庭不受協議例外支持」
最終,代碼如下:
InetSocketAddress inetAddress;
//this is done to keep backward compatibility prior 2.0.4 release
if(host == null || host.equals("")) {
//check if defaultIp is also empty
if (defaultIPAddress == null || defaultIPAddress.equals(""))
throw new UnknownHostException();
//otherwise start listening on defaultIp
else
{
inetAddress = new InetSocketAddress(defaultIPAddress, port);
}
}
//start listening on host
else
{
inetAddress = new InetSocketAddress(host, port);
}
// open the socket channel
this.channel = SocketChannel.open(inetAddress);
this.channel.configureBlocking(false);
this.channel.socket().setTcpNoDelay(true);
試圖打開插座在
this.channel = SocketChannel.open(inetAddress);
不用說當它失敗,我甲肝如前所述,在我的Manifest中需要的權限,這在模擬器中工作正常。
此外,這不是網絡的問題,這兩臺計算機都連接到一個無線WIFI使用創建路由器我手頭,沒有防火牆,proxys,完全開放的,把它這樣...
有任何想法嗎?
謝謝! 亞歷克斯
嗯,我試過2.3.3設備,它的工作原理...... ICS中必須包含打破我的代碼...... – AlejandroVK