Message15217
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.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:12:01 | admin | link | issue707074 messages |
2007-08-23 14:12:01 | admin | create | |
|