[xSocket-develop] "Address already in use" errors and a question about the connection pool
Status: Inactive
Brought to you by:
grro
|
From: Christiaan W. <cwi...@te...> - 2007-10-31 13:35:20
|
Hi there, I have a client doing lots of request to a HTTP server, using about 20 simultaneous connections. I use a while loop to create as many connections as possible, and if I'm at max, I'll wait until another connection was closed. This appears to work just fine for a while. But then, I start getting these exceptions: java.net.BindException: Address already in use: connect at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507) at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:81) at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:65) at org.xsocket.stream.io.impl.IoProvider.openSocket(IoProvider.java:356) at org.xsocket.stream.io.impl.IoProvider.createClientIoHandler(IoProvider.java:219) at org.xsocket.stream.Connection.<init>(Connection.java:162) at org.xsocket.stream.NonBlockingConnection.<init>(NonBlockingConnection.java:396) at org.xsocket.stream.NonBlockingConnection.<init>(NonBlockingConnection.java:154) They occur in the constructor of connection NonBlockingConnection. This happens with 1.2 and 1.2.1 Also, this started occurring after I implemented onConnect, instead of sending the http POST data right after the construction of the NonBlockingConnection. Mostly, the second time I try to create the connection, it works, but this should not be happening I guess... So, what's the problem here? It looks like someone is trying to bind a socket to a local tcp port that is already taken fore some reason. Kind regards, Christiaan Willemsen |