[Twisted-Python] Receiving large packets with TCP
radeex at gmail.com
Mon Jul 11 07:58:44 EDT 2005
On 7/11/05, Stefan Näwe <naewe.s at atlas.de> wrote:
> I'm having trouble receiving the whole contents of large telegrams.
> For example one telegram is exactly 7452 bytes long but I only get
> 2920 bytes.
> Some parts of my code:
> class MyReceiver(Protocol):
> def dataReceived(self, data):
> if __debug__: log.msg("Received %d bytes" % len(data))
dataReceived will be called with arbitrarily-sized chunks of data. You
can never assume how much data will be given to you. If you're
expecting more, buffer it until you receive everything you need.
Twisted | Christopher Armstrong: International Man of Twistery
Radix | -- http://radix.twistedmatrix.com
| Release Manager, Twisted Project
\\\V/// | -- http://twistedmatrix.com
|o O| |
More information about the Twisted-Python