[Twisted-Python] What is wrong with this instance?

Michał Tyde ajchos at wp.pl
Thu Aug 11 09:50:39 EDT 2005

First I wanted to say is that i attached a file with _working_ code.
Please try to change a user nad password in telnet_User, and
> With this longer example I'm not sure what part of it is not behaving
> as you expect.
Please read the thread: [Twisted - Python] Telnet client & keeping
connection alive. I want to send to connected telnet server a "pwd"
command every 20 sec. Here I got less (5 sec.) to wait for effects ->
see task.LoopingCall(telnet_KeepAlive2). In function telnet_KeepAlive2 I
try to execute function from TelnetProtocol class (function
telnet_KeepAlive). It doesn't execute, and becouse of that is after #

With this line commented program works just fine (executes every 5 sec.
a telnet_KeepAlive2() ),but it does nothing important. Run this program
with this line commented, You should see that he prints (after
keeping alive 1
keeping alive 2
keeping alive 1
keeping alive 2
but I must to execute telnet_KeepAlive() method (from TelnetProtocol,
_and this is the problem_). This method should send by self.write("pwd\n
\r") command to telnet server. Sorry if I repeat myself, but I try to
explain the problem the best way I could. If I uncoment line in
telnet_KeepAlive2 (line: tel.telnet_KeepAlive()),my telnet client
connect to server and now do nothing (doesn't get into telnet_KeepAlive2
> I feel like I'm trying to read minds here, and I'm not very good at
> that :)
Me neither :).

I know that my problem has something common with instance of class
TelnetProtocol. How to could I pass on a TelnetProtocol method or
instance to interior of telnet_KeepAlive function? Or maybe there is
another solution.
Thank You in advance for answers.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stara.py
Type: text/x-python
Size: 5407 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20050811/69dfa38e/attachment.py 

More information about the Twisted-Python mailing list