EXTERNAL: OSError: [Errno 48] Address already in use
Marko Rauhamaa
marko at pacujo.net
Tue Jul 3 08:26:58 EDT 2018
Gregory Ewing <greg.ewing at canterbury.ac.nz>:
> Marko Rauhamaa wrote:
>> Nevertheless, the later socket object cannot unilaterally take over a
>> socket using SO_REUSEADDR. The earlier socket object must have set the
>> same option previously.
>
> I just did an experiment that suggests that's not the case.
> I created a socket without SO_REUSEADDR, made a connection to
> it, and killed it. Then I created another socket within the
> timeout period with SO_REUSEADDR, and it succeeded.
>
> This was on MacOSX -- it's possible that other systems
> behave differently.
I tried it, too, (on Linux) and it failed.
It's crucial that the killed party is the server for the situation to
arise.
That's why polite clients close their end of the connection before
the server. Whoever closes first will suffer the TIME-WAIT state.
Marko
More information about the Python-list
mailing list