why does socket.makefile require non-blocking mode?

greg greg at cosc.canterbury.ac.nz
Sun Apr 6 18:37:56 EDT 2008


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
buffer waiting to be read.

When using select(), you really need to deal with the
socket directly, with no buffering in the way.

-- 
Greg



More information about the Python-list mailing list