[Twisted-Python] Twisted usage

vitaly at synapticvision.com vitaly at synapticvision.com
Thu Apr 15 10:21:07 EDT 2010

Yes, thank you.

Quoting "Glyph Lefkowitz" <glyph at twistedmatrix.com>:

> On Apr 14, 2010, at 10:51 AM, vitaly at synapticvision.com wrote:
>> hi,
>> is there any examples how to create (using Twisted)
>> client that creates several TCP requests one after another and handle in
>> asynch manner TCP responses for previous requests?
>> Thanks.
> twisted.protocols.amp and twisted.spread.pb both implement this.
> In a nutshell: in connectionMade, initialize a dictionary on your  
> protocol object mapping request IDs to Deferreds.  When you issue a  
> request, make a new Deferred and put it into that dictionary.  When  
> you receive a response, pop the Deferred out of that dictionary by  
> looking up the key present in the response, and call its .callback()  
> method.
> Is that what you were looking for?
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list