using cmd.exe as a telnet client

Grant Edwards grante at visi.com
Mon Dec 6 13:02:10 EST 2004


On 2004-12-06, Donnal Walter <donnal at donnal.net> wrote:
> Grant Edwards wrote:
> > You don't have to start from scratch. The telnet module has
> > hooks built-into it1 so that you can have it call your routines
> > to handle option negotiation.  I did it once to impliment some
> > extra Telnet protocol features, and it wasn't difficult.
>
> Ok, you've inspired me to give it a try. First, I am assuming
> that you mean writing a custom callback function to send to 
> Telnet.set_option_negotiation_callback(callback).

Yes.

> Or did you mean writing a subclass of Telnet?

That depends.  If you need to _impliment_ a feature in addition
to doing the negotiation, then you may want to define a
subclass -- though it may easier to just grab the source for
telnetlib and add the feature.

> Can someone provide an example of a callback function that I
> might use as a template for writing mine?

I've got a negotiation function at home I'll try to remember to
post.

> This is unfamiliar territory for me, but as near as I can tell, the 
> options in question are:
> 0, binary transmission
> 1, echo
> 3, suppress go ahead
> 23, send location
>
> And it may be that not all of these are critical, but if so, I
> don't know how to tell which is which.

That's the tricky part. :)

I guess I'd "enable" negotiation of each of the features one at
a time, and see what happens.

-- 
Grant Edwards                   grante             Yow!  Hey, I LIKE that
                                  at               POINT!!
                               visi.com            



More information about the Python-list mailing list