Socket Bind Error
- by rantravee
Hi,
I have a test application that opens a socket , sends something through this socket and then closes it . This is done in a loop for 5-10.000 times. The thing is that after 3,4000 iterations I get an error of this type :
enter code here
java.net.BindException: Address already in use: connect
I even set the socket to be used immediattly, but the error persists
enter code here
try
{
out_server.write(m.ToByteArray());
socket_server.setReuseAddress(true);
socket_server.close();
}
catch(Exception e)
{
e.printStackTrace();
System.out.println(i+" unable to register with the server");
}
What could I do to fix this ?