Antoine Pitrou <pit...@free.fr> added the comment: > Actually, it seems that even though the documentation doesn't mention > sockets in TIME_WAIT state, SO_REUSEADDR is actually required on > Windows: > http://twistedmatrix.com/trac/ticket/1151#comment:18
According to that message, we would only need (or desire) SO_EXCLUSIVEADDRUSE. Note however what the MSDN doc says: “Conversely, a socket with the SO_EXCLUSIVEADDRUSE set cannot necessarily be reused immediately after socket closure. For example, if a listening socket with SO_EXCLUSIVEADDRUSE set accepts a connection and is then subsequently closed, another socket (also with SO_EXCLUSIVEADDRUSE) cannot bind to the same port as the first socket until the original connection becomes inactive.” ... and goes on to discuss the virtues of shutdown() etc. So I still think we need no option at all under Windows, and SO_EXCLUSIVEADDR actually prevents the behaviour we are trying to avoid. > So the proper solution is the one adopted by support.bind_port(), > SO_REUSEADDR + SO_EXCLUSIVEADDRUSE. I think you read it wrong. bind_port() only uses SO_EXCLUSIVEADDRUSE and forbids SO_REUSEADDR. Not surprising considering the commentor above, Trent, is the same that wrote the bind_port() code :) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8184> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com