[Twisted-Python] Sending commands when using Telnet client

Don Smith donwsmith at gmail.com
Tue Feb 28 17:26:03 EST 2006

Thank you, thank you, thank you!!!


On 2/28/06, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Tue, 28 Feb 2006 10:59:50 -0800, Don Smith <donwsmith at gmail.com> wrote:
> >Yes, I'm sort of a Twisted newbie, so maybe this has an obvious answer,
> but
> >I'm just not seeing it.
> >
> >I have a Twisted program that I need to add in the ability to make a
> client
> >telnet connection to a remote server and send some commands to it and
> deal
> >with the data received.
> >
> > [snip]
> >
> >This all works great, except that the command sequence is hard coded in
> the
> >TelnetClient class. I want to be able to reference the "cmd" parameter,
> >which could be a list of commands to iterate over,etc. But I don't see
> how I
> >can access the "cmd" parameter that gets passed into the TelnetConnection
> >class from within the TelnetClient class.
> >
> >I'm really desparate for some help, I've been racking my brain on this
> since
> >yesterday morning.
> The usual approach is to save the data (`cmd' in this case) on the factory
> and use `self.factory.stuff' from the protocol.  The `factory' attribute is
> set on the protocol class by the default `buildProtocol' implementation.  It
> is not available in the protocol's `__init__', but is available by the time
> `connectionMade' is called.
> Jean-Paul
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060228/04c52bb3/attachment.htm 

More information about the Twisted-Python mailing list