telnet read_sb_data

Arne arne.meissner at gmx.de
Fri Apr 14 07:59:23 EDT 2006


Thank you for your reply.

Yes I have read the documentation. But I am not sure what is the SB/SE 
suboption. Is this a suboption on the remote machine or for Python.
Maybe you could be so kind and explain it to me with a little code example.

Thany you very much!
Arne

"Dennis Lee Bieber" <wlfraed at ix.netcom.com> schrieb im Newsbeitrag 
news:2khu32leqvokk8jnt67nsf4e1f4bnr5deq at 4ax.com...
> On Thu, 13 Apr 2006 23:45:06 +0200, "Arne" <arne.meissner at gmx.de>
> declaimed the following in comp.lang.python:
>
>> 1. What I look for is the option to get only certain parts of the output. 
>> It
>> seems to me that the command "read_sb_data" can do this. The 
>> documentation
>> says, that I will get the data between the SB/SE pair. But I don't know 
>> how
>> to invoke the SE command in Unix. Even I don't know the SE command.
>>
> Did you read the full documentation? "SB/SE" are "suboption
> begin/end", and there is also mention of a "callback". The ONLY other
> entry in telnetlib that mentions callbacks is the one for negotiating
> telnet options.
>
> read_sb_data( )
> Return the data collected between a SB/SE pair (suboption begin/end).
> The callback should access these data when it was invoked with a SE
> command. This method never blocks.
>
> set_option_negotiation_callback( callback)
> Each time a telnet option is read on the input flow, this callback (if
> set) is called with the following parameters : callback(telnet socket,
> command (DO/DONT/WILL/WONT), option). No other action is done afterwards
> by telnetlib.
>
>
>> Using os.stat(path) doesen't work on XP, I am always getting a 0 return
>
> No surprise -- os.stat can only access files mounted on the local
> machine. Telnet is remote /terminal/ connection. You'll have to behave
> like a terminal... How would you, as a user at a terminal, know when any
> command had finished? Probably by seeing a console prompt...
>
> Try
>
> read_until( expected[, timeout])
> Read until a given string, expected, is encountered or until timeout
> seconds have passed.
> When no match is found, return whatever is available instead, possibly
> the empty string. Raise EOFError if the connection is closed and no
> cooked data is available.
>
> You'll have to know what the prompt string will be...
> -- 
> > ============================================================== <
> >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
> >      wulfraed at dm.net     |       Bestiaria Support Staff       <
> > ============================================================== <
> >           Home Page: <http://www.dm.net/~wulfraed/>            <
> >        Overflow Page: <http://wlfraed.home.netcom.com/>        < 





More information about the Python-list mailing list