I faced a very weird socket behavior while trying to re-bind a socket. After I shutdown the socket, I can re-bind to the same port without any problem as long as my application still runs. But, if I shut down the application (socket shutdown), and all threads exits, and restart the app again, it cannot re-bind, it complains the address is in use!!

I solved it by setting the option SO_REUSEADDR. However, I am not yet convinced, how come the port is still in use while the application exited. :confused:

Posted on 2003-10-03 18:47:58 by hosam_shahin