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