[Twisted-Python] [Twisted - Python] Telnet client & keeping connection alive
First i want to thank all people that responsed for my ealier questions. I have done a progress in my project.I am a green in Twisted/Python, and network programming in general. Now I got a working telnet client. I have got two kind of telnet servers. First one (after succesfuly login) keeps connection even if I don't send a command to him. Second one disconnect me every 30 sec., if I don't send command to him. So I want to create a thread (after connection to the server) that will send to him a "pwd" command. I want this thread to run constantly and sending every 20 sec "pwd" command. Of course in the meantime i want to get responses for my enother commands. Is this the best idea? Where should I do this (in protocol or in factory)? Maybe there is another solution. Where can I find some tutorials with code examples about threads in Python/Twisted? Please send me a link with working pattern of telnet client in Twisted. I have look for this kind of code but i couldn't find anything. I don't know if my code is good (he works, but sometimes I dont know why). Maybe some suggestions. Thank You in advance for answers.
On Wed, 2005-08-10 at 15:17 +0200, Michał Tyde wrote:
First i want to thank all people that responsed for my ealier questions. I have done a progress in my project.I am a green in Twisted/Python, and network programming in general. Now I got a working telnet client. I have got two kind of telnet servers. First one (after succesfuly login) keeps connection even if I don't send a command to him. Second one disconnect me every 30 sec., if I don't send command to him. So I want to create a thread (after connection to the server) that will send to him a "pwd" command.
You don't need a thread; twisted lets you schedule events. Look at reactor.callLater and twisted.internet.task.LoopingCall: http://twistedmatrix.com/projects/core/documentation/howto/time.html
As for scp and rsync-ssh I don't know of any out of the box solutions, however if you're good with Python you may want to take a look at conch (a component of Twisted, http://twistedmatrix.com/), which is a Python implementation of the SSH protocol. I've personally seen it used to implement restricted virtual scp, but I don't think any such package has been released. Twisted does of course also have a FTP component that can be used more or less out of the box. I'm not really very familiar with the implementation of rsync, but I can't imagine it would be too hard to implement either.
Hello: I would like to implement a backup client in Python - possibly with Twisted Conch or similar tools. I would like the client to operate like rsync through ssh, and I am not sure how I should approach this functionality. Can I use the OS' rsync through Twisted's ssh client? Is there a python module that can be used through twisted's ssh client? Has anyone on this list worked on anything like this? I saw this posted on a newsgroup: link: http://lists.nycbug.org/pipermail/talk/2004-June/001512.html I am not sure how true this is after reading the twisted docs and examples. I did some searching in the twisted archives, but not all of it... sorrry in advance if this topic has been hammered into the ground. David
participants (3)
-
David Dahl
-
Itamar Shtull-Trauring
-
Michał Tyde