I want to be able to reuse some ports, and that's why I'm using setsockopt on my sockets, with the following code:
sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
However, this doesn't really work. I'm not getting a bind error either, but the server socket just isn't responding (it seems to start , but if I try to connect to it, it doesn't enter the select loop). This behaviour appears if the script ended unexpectedly, and if I change the port the server is listening on, everything works again. Can you provide some advice?
EDIT: I renamed the socket to sock. It was just a name I chose for this code snippet.