Am I misusing socket.setdefaulttimeout here?

Dave Brueck dave at pythonapocrypha.com
Thu Mar 20 17:26:48 EST 2003


On Thu, 20 Mar 2003, Skip Montanaro wrote:

>     >> 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> timeoutsocket.py 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
> doc:
>
>     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.

Doh! That's a real shame - the only time I ever really needed timeouts was
with those higher-level modules. Oh well... thank goodness for
timeoutsocket.py!

Thanks,
-Dave





More information about the Python-list mailing list