[Twisted-Python] help needed with flow-control for push protocol

Pietro Niccoli piemail at tiscali.it
Thu Nov 5 12:52:55 EST 2009


I need assistance figuring out how to create a push protocol that implements
flow control.

To keep things simple, I'm trying to build a push-based echo server.  It
(1) accept incoming tcp connections
(2) on each connection, all data rec'd should be echo'd unchanged.
(3) should the output transport request that transmission be "paused,"
the input transport (in this case, the same socket) should be similarly

This would seem to be a simple problem.  I think my "PushEcho" class
should implement both IConsumer and IProducer interfaces; As a consumer,
its dataRecieved method would cause it to act like a producer and call
the transport's dataReceived method.  Similarly, as a producer, it's
pause, and resume methods would be called, and they would (as a
consumer) just call the same functions in the transport.

However, I can't get the plumbing right.

Can someone help by providing pointers or some sample code?


More information about the Twisted-Python mailing list