[Python-bugs-list] [ python-Bugs-707074 ] timeouts incompatible w/ line-oriented protos

SourceForge.net noreply@sourceforge.net
Thu, 20 Mar 2003 10:58:56 -0800


Bugs item #707074, was opened at 2003-03-20 12:58
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=707074&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: timeouts incompatible w/ line-oriented protos

Initial Comment:
I've come to the conclusion that, as written, the higher level line-
oriented protocols which use the socket library (httplib, ftplib,
xmlrpclib, etc) won't work with socket timeouts.  They generally do
something like:

    self.file = self.sock.makefile('rb')

then use file methods to send and receive data on the socket.

Alas, the socket docs state:

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.  

I view this state of affairs as a bug which should be fixed at some
point, as these higher level protocol modules are probably the 
predominant way sockets get used in Python programs.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=707074&group_id=5470