[Twisted-Python] How to stop reactor when execution finishes on more than one ssh server?

James Deng jtdeng at gmail.com
Sat Sep 29 13:08:52 EDT 2007


Hi,
in the sample sshsimpleclient.py, it demostrated how to connect to a ssh
server and issue a command. my question is what should I do if I want to
connect to more than one ssh server.

I did try to create more than one SimpleTransport by using the following
code

HOSTS=[host1, host2, host3]
protocol.ClientCreator(reactor, SimpleTransport).connectTCP(host1, 22)
protocol.ClientCreator(reactor, SimpleTransport).connectTCP(host2, 22)
protocol.ClientCreator(reactor, SimpleTransport).connectTCP(host3, 22)
reactor.run()

this really behaves as what i expected, and executed the command on all
remote hosts, but after it finishes, i just hangs there, I know I need a
place to call something like reactor.stop() when all transport finishes the
execution. but i do not know where to call it,  need some deffereds? and
how?

thanks very much!

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070930/ba0a6eb7/attachment.htm 


More information about the Twisted-Python mailing list