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 _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 with a try...finally. Other methods have similar problems.

> I wanted to use file-like objects with socket timeouts, so I ended up writing
> my own replacement for socket._fileobject.  I'd appreciate it if someone could
> either explain to my why my new class was unnecessary, or else encourage me to
> contribute it as a patch to the socket module.

Sure, fix it. A harder problem is that it doesn't play nice with select().


-- 
--Bryan



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to