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). Or did you mean writing a subclass of Telnet? Can someone provide an example of a callback function that I might use as a template for writing mine?
This is unfamiliar territory for me, but I tried to snoop a bit using ethereal (also new to me) and 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.
Eyal Lotem wrote:
I think I have a much simpler solution for you guys.. Assuming you can run arbitrary code on the proprietary server.
Actually I cannot. The server runs a second-party information system, the primary access to which is third-party terminal emulator software that uses telnet connections. What I am trying to do is emulate this emulator. :-)
cmd.exe is not a command line program. It's a terminal (emulator). You might be able to use the telnet program, though.
Yes, I see that now. Thanks.
Before doing this, I'd recommend looking at Twisted's telnet support (both
the version in 1.3 and the version that will be in 2.0),
which actually supports option negotiation in a
reasonable way.
I've been wanting to get acquainted with Twisted for awhile now, so this might be a good time to do so. I think I will give Grant's idea a whirl, but if I get bogged down there, I will definitely look at Twisted's telnet support. BTW, do you know if Twisted's option negotiation uses a callback function? I might download it just to take a look, even if I don't use it directly.
Thanks, Donnal Walter Arkansas Children's Hospital
-- http://mail.python.org/mailman/listinfo/python-list