using cmd.exe as a telnet client

Jp Calderone exarkun at divmod.com
Tue Dec 7 10:18:32 EST 2004


On Mon, 06 Dec 2004 12:52:31 -0600, Donnal Walter <donnal at donnal.net> wrote:
>I wrote:
> > I've been wanting to get acquainted with Twisted for awhile
> > now, ... BTW, do you know if Twisted's option negotiation
> > uses a callback function? I might download it to take a look, ...
> 
> Sorry I did not do this earlier, before I posted. It is obvious (now 
> that I have downloaded it) that Twisted's Telnet implementation is based 
> on its own Protocol base class (nice design). The only documentation I 
> have been able to find, however, is in the protocols/telnet module 
> itself. It is still not immediately obvious (to me) how to use the iac* 
> methods to negotiate these options. Any help is much appreciated.
> 
> (I've not given up on writing my own funtion for Python's telnetlib, but 
> I'm trying to keep all my options open. Besides, I will probably have 
> other uses for Twisted later.)

  The iac_FOO method will be called whenever the telnet command FOO is received with the command's "argument" (the byte following it) as its only argument.  When a subnegotiation is received, iacSBchunk is called.

  That's the 1.3 API, anyway.  It will still exist in 2.0, but it is lookingly increasingly likely that the new version will be ready in time for 2.0.  With the new API, the enableLocal() method is invoked when an option negotiation initiated by this side of the connection is allowed by the remote side, and enableRemote() is invoked when the remote side has requested an option be enabled (it can return true or false to allow or deny the enabling).  Similar disableLocal() and disableRemote() methods exist.  Callbacks can be registered for subnegotiation, based on the command for which the subnegotiation is negotiating options.  There are also do() and dont() methods that return Deferreds.  There's a whole bunch of other new cool features too, but I've probably gone on long enough, especially for a module that hasn't even been released :)

  Jp



More information about the Python-list mailing list