Am I misusing socket.setdefaulttimeout here?

Skip Montanaro skip at
Thu Mar 20 21:22:01 CET 2003

    >> Turns out timeouts don't play well with files.

    Dave> Can you elaborate on how they don't work right? I'm still using
    Dave> for some stuff and was hoping to migrate away
    Dave> from that, but it of course works great with httplib, xmlrpclib,
    Dave> etc.

I made that assumption based upon this paragraph from the 2.3 socket module

    Timeout mode internally sets the socket in non-blocking mode.  The
    blocking and timeout modes are shared between file descriptors and
    socket objects that refer to the same network endpoint.  A consequence
    of this is that file objects returned by the makefile() method should
    only be used when the socket is in blocking mode; in timeout or
    non-blocking mode file operations that cannot be completed immediately
    will fail.


More information about the Python-list mailing list