Re: why does socket.makefile require non-blocking mode?

2008-04-06 Thread greg
Forest wrote: > I guess you mean that since _fileobject.read() calls recv() multiple > times, the second and later calls might block even if select() said the > socket was > readable. The main problem is buffering. The select() may block on the socket even though the file object has data in its bu

Re: why does socket.makefile require non-blocking mode?

2008-03-31 Thread Forest
Bryan Olson wrote: >Looking at the code for the existing _fileobject's read method, it >will loose data it has already read if a socket.recv() call raises >an exception. The function keeps buffers in a local variable that >will be lost if an exception exits the scope. That much could be >fixed wit

Re: why does socket.makefile require non-blocking mode?

2008-03-31 Thread Gabriel Genellina
En Mon, 31 Mar 2008 14:15:56 -0300, Forest <[EMAIL PROTECTED]> escribió: > My main concern is this: A brief look at the existing socket._fileobject > shows that its read() method calls recv() in a loop, appending to a > temporary buffer on each pass, and finally returning the buffer when > recv()

Re: why does socket.makefile require non-blocking mode?

2008-03-31 Thread Forest
On Sat, 29 Mar 2008 08:18:23 -0300, Guilherme Polo wrote: >I don't know why you think timeout is forbidden too, it is not. I can't tell for sure whether it is or isn't, because of this language in the socket module docs: "s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is

Re: why does socket.makefile require non-blocking mode?

2008-03-29 Thread Guilherme Polo
2008/3/28, Forest <[EMAIL PROTECTED]>: > The socket.makefile() docs say, "the socket must be in blocking mode." I > don't see any explanation of why blocking mode is required, and I'm not sure > whether that means timeout mode is forbidden as well. Can someone clarify > this? > Have you set y

Re: why does socket.makefile require non-blocking mode?

2008-03-28 Thread Bryan Olson
Forest wrote: > The socket.makefile() docs say, "the socket must be in blocking mode." I > don't see any explanation of why blocking mode is required, and I'm not sure > whether that means timeout mode is forbidden as well. Can someone clarify > this? Looking at the code for the existing _fileob

why does socket.makefile require non-blocking mode?

2008-03-28 Thread Forest
The socket.makefile() docs say, "the socket must be in blocking mode." I don't see any explanation of why blocking mode is required, and I'm not sure whether that means timeout mode is forbidden as well. Can someone clarify this? I wanted to use file-like objects with socket timeouts, so I ended