twisted.client

Python Twisted Client Connection Lost

99封情书 提交于 2019-12-23 15:17:13
问题 I have this twisted client, which connects with a twisted server having an index. I ran this client from command-line. It worked fine. Now I modified it to run in loop (see main() ) so that I can keep querying. But the client runs only once. Next time it simply says connection lost \n Connection lost - goodbye! . What am i doing wrong? In the loop I am reconnecting to the server, it that wrong? from twisted.internet import reactor from twisted.internet import protocol from settings import AS

Twisted - I need to periodically connect/disconnect a client connection

孤街醉人 提交于 2019-12-11 05:43:29
问题 I have a twisted tcp client that I would like to periodically cause to connect, receive a stream of date for n seconds, then disconnect. After disconnecting n seconds would elapse before the process started over again. Below is a very abbreviated extract of the code I've tried so far. When I run the code the reactor.stop() is issued, and after the sleep elapses I get a twisted.internet error 'ReactorAlreadyRunning' when the reactor.run() is invoked in startClientConnection() I'm a raw novice