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

Steve Holden steve at holdenweb.com
Tue Nov 2 20:29:20 EST 2004


Michael Fuhr wrote:

> clarence at silcom.com (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".

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list