Message152697
| Author |
pitrou |
| Recipients |
BreamoreBoy, gearb0x, jnoller, neologix, news1234, pitrou, python-dev |
| Date |
2012年02月05日.17:16:38 |
| SpamBayes Score |
5.3594935e-08 |
| Marked as misclassified |
No |
| Message-id |
<1328462040.3420.7.camel@localhost.localdomain> |
| In-reply-to |
<CAH_1eM3eq87=BtaLTr02xh8JnOGt-WThMvd9tRfFt_K8yMPq7A@mail.gmail.com> |
| Content |
> 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 :) |
|