Re: [Twisted-Python] What is wrong with this instance?
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
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 telnet_Password. try to execute function from TelnetProtocol class (function telnet_KeepAlive). It doesn't execute, and becouse of that is after # sign. 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 connection): 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 loop).
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.
participants (1)
-
Michał Tyde