Problems with read_eager and Telnet

Jack Diederich jackdied at gmail.com
Mon Feb 28 12:35:24 EST 2011


On Mon, Feb 28, 2011 at 12:13 PM, Roberto Inzerillo
<roberto.inzerillo at gmail.com> wrote:
> Yes. read_eager() will never actually read from the socket, if it has
>>
>> any data it has already read & processed it will return those.  If you
>> call it enough times it will just start returning empty strings
>> because it never asks the socket to read & wait for new data.
>
> Can you point me to a pratical usage example of read_eager()? Maybe that
> will help me in making all this clear. I'm still very fuzzy about the socket
> and the processing stuff.
>
> I'm still convinced I cannot use read_until() in my project and I'm
> determined in looking into the read_eager(), maybe that will be of any help
> if carefully used.

If you always want to see the response you have to use read_until().
All the other read_* methods don't guarantee you will get the text you
want because they don't wait for the other end of the connection to
have actually sent the data.  It's a bummer, but if the server hasn't
returned the data there is nothing magic that telnetlib can do to make
it true.



More information about the Python-list mailing list