On 08:36 am, albert.bra...@weiermayer.com wrote: >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.
You might want a producer/consumer-based API. Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python