开发者

Android socket won't connect via .connect() function, only new Socket()

So I continue to work on my Android network scanner, and now on my Android tablet I get this problem.

Using the following code, I get a successful connection.

Socket mySocket = new Socket(iIPv4 + i, port);

Using th开发者_运维技巧is code, it fails to ever connect.

Socket mySocket = new Socket();
SocketAddress address = new InetSocketAddress(iIPv4 + i, port);
mySocket.connect(address, 1000);

The problem is, I need to lower the timeout as seen via the .connect() function. 1000 is way too high, I just tried raising it for debugging purposes.

Anyone got any ideas?


I found the problem. I needed to go into a memory manager and terminate the process manually in order to clear things up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜