![](https://secure.gravatar.com/avatar/1f31b219cdd0dfc289095a32887a3405.jpg?s=120&d=mm&r=g)
Michael Mata wrote:
Christopher Armstrong wrote:
On Sat, 20 Nov 2004 23:12:18 -0800, Michael Mata <michael.mata@gaigen.net> wrote:
Is there a way to extend the LineReceiver protocol to take action on a continued, periodic basis? Currently, the protocol only does work when a line is received. However, there are times when the script should take action without waiting to receive a line.
It doesn't have anything to do with the protocol; what you want is reactor.callLater(seconds, functionToCall)
http://twistedmatrix.com/documents/current/howto/time has more information.
The function task.LoopingCall(runEverySecond) from twisted.internet looks like a good fit for scheduling recurring maintenance.
Where should task.LoopingCall(runEverySecond) be placed? I'm currently using internet.TCPServer, which is passed the port number and a protocol factory. The protocol inherits from basic.LineReceiver. I tried placing the task in the factory's __init__ function, but it doesn't seem to run.