Hi there!

I have a Java client socket application now running in Linux (Fedora Core 6 with Sun JRE 1.4.2). This client socket establishes a persistent TCP connection (some sort of, at least) to a server. It sends messages and listens for responses.

Summing up, the problem is: The application is running - I close the application - I immediately restart the application and "java.net.NoRouteToHostException: Cannot assign requested address" error occurs; after 60 seconds the application succeeds in connecting. If, however, I restart the application and bind the socket to another port, it connects without problems.

I don't know if Linux sets this connection in a "frozen" state or whatever and releases it after a certain amount of time.. I have setReuseAddress(true)... and besides, why does it connect using another port? This is confusing for me, mainly because I don't get error at socket.bind(..) when restarting the app using the same port.

Can anyone give me a hint on this?
Thanks a lot!