Thanks Adam Atlas $B!u(B Arnar Birgisson,
But I want to receive binary data in my protocol.
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
Twisted-Python mailing list