how to read o/p of telenet (python) ?!

Ian Kelly ian.g.kelly at gmail.com
Sat Dec 11 12:44:04 EST 2010


On 12/11/2010 4:20 AM, Darshak Bavishi wrote:
> i have code to telnet remote machine (unix)
> i am using port 5400 to telnet but o/p is not in visible format when i
> run random commands or run

What is "o/p"?

> when i give as read_some() it displays some lines but in case of
> read_all() it gets hang !!

read_all() blocks until the server closes the connection.  If the server 
is waiting for a command, then it will be blocking for a long time.

Try sending the "exit" command before you call read_all().  The server 
should finish processing the previous command before exiting, so you 
will still receive all of the requested data.

Cheers,
Ian




More information about the Python-list mailing list