[Twisted-Python] How to cap the buffering size of data to be sent in Protocol class

Phil Mayers p.mayers at imperial.ac.uk
Wed Sep 22 04:32:03 EDT 2010

On 09/22/2010 08:52 AM, Weikai Xie wrote
>      My questions is that whether there is any mechanism in Twisted
> which can be used to set the maximum buffering size of the Protocol;
> and whenever if this cap is reached, I can be informed to give a
> chance to know the client is experiencing problem

You need to implement a producer/consumer interface. I'm not very 
familiar with them, but there have been good examples in the past.

Basically your data source should be a producer and the protocol should 
be a consumer. When the protocol (consumer) buffer is full, it'll notify 
the producer to stop producing.

More information about the Twisted-Python mailing list