[Twisted-Python] LineReceiver Protocol

Michael Mata michael.mata at gaigen.net
Sun Nov 21 02:12:18 EST 2004


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.

For example, suppose a connection should be closed if it has been idle 
for more than X minutes.  However, if connection is idle, it will not be 
sending commands.  If no commands are sent, then no lines are received, 
which means there is no way to close the connection.

Another example might be a global message that needs to be sent to all 
connections.  The message would have to be stored in  message queue and 
sent only when lineReceived is called.  It would be nice if the message 
could instead be sent imediately even if the connection was currently idle.




More information about the Twisted-Python mailing list