[Twisted-Python] How to see the number of received msgs?

Jean-Paul Calderone exarkun at divmod.com
Tue Dec 9 13:41:20 EST 2008

On Tue, 09 Dec 2008 17:12:32 +0100, Gabriel Rossetti <gabriel.rossetti at arimaz.com> wrote:
>tarjei wrote:
>>Hash: SHA1
>>Gabriel Rossetti wrote:
>>>Hello eveyone,
>>>is there a way to see how many msgs have been received and are waiting
>>>to be processed by a client?
>>Hi, I think you need to be far more specific if you want an answer.
>>Which protocol is this for example?
>TCP, but I assuming that Twisted gets stuff from the OS's buffer and puts it 
>in it's own buffer, this may not be the case though, if it's not then my 
>question makes no sense.

The TCP transport implementation in Twisted calls the protocol's dataReceived
method *immediately* with any bytes it receives.  In other words, received
data is never buffered.  So the answer to your question is that the number
is always zero.

Additionally, TCP has no notion of messages.  There's just a stream of bytes
from which arbitrarily short or long sequences of bytes may be read.


More information about the Twisted-Python mailing list