Twisted - I Need To Periodically Connect/disconnect A Client Connection
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
Solution 1:
reactor.run()
should be run only once.
from twisted.internet import task, reactor
def connect():
do_connect()
reactor.callLater(60, disconnect) # disconnect in a minute
task.LoopingCall(connect).start(120) # call connect() every 2 minutes
reactor.run()
Post a Comment for "Twisted - I Need To Periodically Connect/disconnect A Client Connection"