[Twisted-Python] How to receive a big stream data?

Adam Atlas adam at atlas.st
Mon Jul 9 01:58:04 EDT 2007

On 2 Jul 2007, at 21.40, steven wang wrote:
> I rewrite my source about MyProtocol. But I can not receive  
> complete data, only a part of data. :( Could you help me?

Have you taken a look at twisted.protocols.basic? There are some nice  
abstractions in there for building chunked protocols. I'd recommend  
NetstringReceiver if you want to keep your protocol text-based. You  
subclass protocols.basic.NetstringReceiver instead of  
protocol.Protocol, and override stringReceived(data). That gets  
called whenever a complete message is received (unlike dataReceived,  
which just gets a series of bytes that may or may not be a complete  

More information about the Twisted-Python mailing list