Reading line-by-line on a socket

Just just at xs4all.nl
Thu Mar 13 22:19:27 CET 2003


In article <b4qrg3$qvg$1 at heckle.cc.uregina.ca>,
 sik0fewl <xxdigitalhellxx at hotmail.com> wrote:

> Hey,
> 
> Is there any way to read line by line on a socket, without having to 
> recv() a chunk and the keep it in some sort of queue to retrieve later?
> 
> The reason this doesn't work for me is because I would like select() to 
> still be able to detect that there is data waiting to be read from the 
> socket. If all else fails I'll just have to do a loop through the 
> incoming queue after my socket has data to be read.
> 
> In short, I want a readline() for a socket.
> 
> Any suggestions?

sock.makefile()

Just




More information about the Python-list mailing list