[Twisted-Python] Problem about Multithread

Glyph glyph at twistedmatrix.com
Sun Mar 18 03:19:30 EDT 2012


On Mar 18, 2012, at 1:36 AM, hz hanks wrote:

> Thank you so much for your instant reply.
> 
> Sorry for my ignorance, but could you tell how to have several
> reactor.connectTCP calls. From the textbook I'm reading, I just know
> that I can
> first call
> reactor.connectTCP(sys.argv[1], int(sys.argv[2]), stdioProxyFactory( ))
> and then call
> reactor.run( )
> Do you mean I can call reactor.connectTCP(sys.argv[1],
> int(sys.argv[2]), stdioProxyFactory( )) several times before calling
> reactor.run( ) ?

Yes, that's the idea.

> Then how my code determine which is the corresponding
> connection?

Pass some arguments to stdioProxyFactory() and then you can refer to self.factory in your protocol.  It should then be easy to figure out which one is which.

-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120318/1a2e34a2/attachment.htm 


More information about the Twisted-Python mailing list