Reusing Address with Sockets
Kuros
kuros at pgtv.net
Sun Nov 10 20:58:44 EST 2002
Hello,
I am writing a TCP server program, and everything is working fine, except
for one minor problem. When I close the program, I cannot reuse the same
address, I have to change the port it runs on. Now, I've tried to do this:
sock.setsockopt(SO_REUSEADDR, SO_LINGER, 1)
But that does not work.
This is my code I use to create the socket...
self._sock.bind(('', port))
self._sock.setblocking(0)
self._sock.listen(5)
Could someone point out what I am doing wrong?
Any help is greatly appreciated!
Kuros
More information about the Python-list
mailing list