setsockopt, SO_REUSEADDR question

greg andruk meowing at banet.net
Wed May 26 23:17:14 EDT 1999


Constantinos A Kotsokalis <c.kotsokalis at noc.ntua.gr> writes:

> Hello people,
>   pardon me if this has been answered before, couldn't find any trails.
>   I have the following code:
{...}  
> srv.socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
> srv.serve_forever()
{so far, so good}
>   What I want it to do is to be able to start a server on port 5050,
>   even if another server was just shut down and there's still a
>   closing listen socket there. Since it does not work, I have to
>   wait about 30 sec between each run of my program.

Are you making sure to shutdown() _all_ your sockets when you are done
with them, including on error conditions?  It matters.




More information about the Python-list mailing list