SocketServer: Address already in use

Heiko Wundram heiko at ph0enix.homelinux.org
Sat May 17 15:49:22 EDT 2003


On Fri, 2003-05-16 at 21:11, Thomas Guettler wrote:
> After some minutes the socket gets released and I can restart the
> server. How can I close the socket of the server cleanly so that I can
> reuse the adress again at once?

You're using Linux, right? AFAIK, the socket gets released when the
connection you made to the socket is phased out of TIME_WAIT mode by the
kernel. You can check this by doing a netstat right after the server
exits.

Anybody prove me wrong, but I think you can't do anything about it, save
patch the kernel TCP/IP stack to have a smaller TIME_WAIT on sockets
that were released when a program crashes...

My workaround: use a dynamic port, so that you can test the server on
another port while this one is release... :)

Heiko.

> 
>  thomas
> 
> -- 
> Thomas Guettler <guettli at thomas-guettler.de>
> http://www.thomas-guettler.de
> 






More information about the Python-list mailing list