Grant Edwards escreveu: > On 2006-06-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Well, actually I´m using a very simple protocol wich sends only > > strings ended by newline. I need to send 3 chunks of information and a > > newline after them. On the reader side I make 3 readline(), this way I > > wouldn´t have to care about this problem, but maybe that´s where I´m > > falling. If that´s the case, I´ll have to use a more complex > > protocol. > > You can't use readline() with select(). Select tells you > whether recv() called on the underlying socket will block or > not. What's probably happening is that all of the data has > been read from the underlying socket and is being held in a > buffer waiting to be read by readline(). >
Yes, as I expected, its the buffers. In my opinion the problem is that the socket module doesn't provide a way of reading all its internal buffer. readlines() just make subsequent calls to readline and readline may call recv, so we have a locked scene. I want to know if I will block anyway. Of course I can clean the buffer myself, but I think the socket module should provide a way of doing this. It's not a big problem though. > The Select call has no way of knowing about that buffered data. > As far as it's concerned there's no more data left to read, so > it block until the socket is closed. You're very right. thanks, Andre LS Meirelles > > -- > Grant Edwards grante Yow! My mind is a potato > at field... > visi.com -- http://mail.python.org/mailman/listinfo/python-list