Telnetlib - Clearing/resetting within a Telnet Object
eddie at holyrood.ed.ac.uk
Wed Mar 20 13:14:50 CET 2002
Mike Lammon <mlammon at nc.rr.com> writes:
>I am writing a small server program to interact with an external
>machine. (It is non-unix). The program connects fine. It
>issues the commands and receives data fine (most of the time).
>This is the problem. The machine I am connected too sends out
>system messages, etc to users who are connected (telnet). I
>can't turn off these system messages so that is not an option.
>The next time I issue a command from the client side, It
>will return the data but its not from the current command
>issued. It returns the next serious of data in sequence.
>I need a way to clear/reset (without destroying the telnet
>session) , then issue the current command.
You haven't given much context but if you can issue commands other than those
to retrieve data AND the remote system only outputs systems messages when the
user is inactive you could send comments and use the echo reply to
synchronise. However if the remote system just spews random text to the
screen then you could try making the remote system send multiple copies of the
data until you get 2 identical results in a row (more if you want to be
absolutely sure). Or you could install something on the remote system which
your telnet program calls to run the commands and collect the output and then
send the data back to you (either using the above method or out of band).
Well those are some ideas.
More information about the Python-list