[Twisted-Python] NetstringReceiver

Albert Brandl albert.brandl at weiermayer.com
Thu Mar 25 04:36:45 EDT 2010


On Thu, Mar 25, 2010 at 09:22:03AM +1100, Andrew Bennetts wrote:
> I'm rather confused about why you're even asking this question.  Exactly
> what API are you proposing as an alternative to the existing API (which
> is subclass NetstringReceiver and override stringReceived, and
> stringReceived will be called for every netstring that is received, as
> soon as it is received)?

Never mind - I didn't understand the concept of deferreds ;-). When
I read the code for FileSender, I thought it might be cool to have
something similar for the NetstringReceiver. But in the case of 
FileSender, the delivery of a file is explicitly triggered by the 
client. 

My vague idea was to create a method beginNetstringReception that 
returns a Deferred. But since Deferred instances are not reusable,
I'd have to call this method each time I wanted to receive a netstring, 
and this is obviously nonsense.

Regards,

--
DI Albert Brandl

Weiermayer Solutions GmbH

4813 Altmünster | Abteistraße 12 | Austria
Fon: +43(0)720 70 30 14 | Fax: +43 (0) 7612 88081



More information about the Twisted-Python mailing list