[issue5293] socket timeouts even in blocking mode

Gregory P. Smith report at bugs.python.org
Wed Feb 18 06:49:02 CET 2009


Gregory P. Smith <greg at krypto.org> added the comment:

Yes it is annoying to have to deal with the different OS specific error
numbers when handling socket.error, OSError, IOError or EnvironmentError
subclasses in general but that is life.  Python does not attempt to
figure out what all possible behaviors and errors are and coerce them
into some common representation because there often is not a common
thing.  Fortunately while there are many network stack behaviors, there
are really only two APIs (posix and windows) so there are only two sets
of error numbers to check for.  The burden is not that great in cross
platform code.

The issue that prompted this bug report: calling socket.connect() once
is not and has never been a way to wait for a server on the network to
come up.  If the server isn't there at the time it was called, it will
return an error once the OS has decided that it has no way to connect. 
The absense of a timeout being specified does not imply that it will
retry the underlying system call for you.  Merely that it won't bail out
early.

I have updated the socket module documentation to clarify this a bit in
r69731.

----------
assignee:  -> georg.brandl
components: +Documentation
nosy: +georg.brandl
resolution: invalid -> fixed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5293>
_______________________________________


More information about the Python-bugs-list mailing list