[Twisted-Python] Interactive control of client?
Hi, I'm fairly new to Twisted, so this may be a stupid question, but that's never stopped me before! :-) Anyhow, I would like to be able to script a tcp client to play around with sending different protocol elements from within the python interpreter. To boil it down to a super-simple example I'll take the EchoClient example. Is there anyway to get a handle to that client and have it send different strings to the EchoServer. I'm imagining being able to do something like this in the python interpreter:
echoclient = SomeWayToGetClient(...) echoclient.sendLine("blah") echoclient.sendLine("bleh")
I'm assuming I would have to have the client run in another thread to be able to allow the python interpreter thread to run as well, but I'm not sure how I would do that. Any Info/help appreciated! cheers, Joel Boehland
[Wow, your MUA must have the narrowest editing area I've ever seen!] On Fri, Jun 20, 2003 at 04:58:20PM -0700, Joel Boehland wrote: [..snip..]
I'm imagining being able to do something like this in the python interpreter:
echoclient = SomeWayToGetClient(...) echoclient.sendLine("blah") echoclient.sendLine("bleh")
I'm assuming I would have to have the client run in another thread to be able to allow the python interpreter thread to run as well, but I'm not sure how I would do that. Any Info/help appreciated!
Slightly different to what you're asking... Try adding a "manhole" to your application. The quick and dodgy way is from twisted.tap.telnet import updateApplication updateApplication(app, {'username':'admin', 'password': '****', 'port':2323}) (where app is your Application instance) This will add telnet interface to your program that presents you with a python prompt. It can be convenient for playing around in a live Twisted app. -Andrew.
participants (2)
-
Andrew Bennetts
-
Joel Boehland