getting socket.bind() exception, but no actual error

Steve Holden steve at
Wed Nov 3 02:29:20 CET 2004

Michael Fuhr wrote:

> clarence at (Clarence Gardner) writes:
>>And the whole point of the test in the exception handling suite (checking
>>for "in use") is to repeat the bind until that's not the case. This is, of
>>course, in a program in development which sometimes is not able to be 
>>restarted right away after a problem.
> Why not?  Because you get "Address already in use" exceptions due
> to old connections still being in the TIME_WAIT state?  If so, are
> you aware that server processes should usually set the SO_REUSEADDR
> socket option before calling bind()?  Or is there some other reason
> that bind() fails?

There is some other reason: the exception argument is (errno 22, Invalid 
argument), which is clearly not "Address in use".

Holden Web LLC +1 800 494 3119

More information about the Python-list mailing list