readline() blocks after select() says there's data??

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 18 01:00:12 EST 2002


Grant Edwards wrote:
> 
> You don't have to read it 1 byte at a time. Just call
> f.read(1024) and it will give you however many bytes are
> available, up to the max of 1024.

If you do this, keep in mind that what you get may
not consist of a whole number of lines. After
processing all the complete lines that you've got,
you have to be prepared to put the rest aside
and wait until select() tells you there's more
to read. In other words, you have to do your
own buffering.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list