socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use')

Hendrik van Rooyen mail at microcorp.co.za
Tue Jan 27 06:52:46 EST 2009


"Laszlo Nagy" <gan.. at s..eus.com> wrote:

> I have a program that uses socket.bind() and socket.listen() frequently. 
> After that program stops, it is not able to bind() again for a while:
> 

 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

This does the trick for me.

- Hendrik





More information about the Python-list mailing list