[Twisted-Python] Problem about Multithread

hz hanks hankshz at gmail.com
Sat Mar 17 23:36:17 MDT 2012


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( ) ? Then how my code determine which is the corresponding
connection?

Thank you so much. Waiting for your reply
Best,
Hanks



在 Mar 17, 2012,6:05 PM,Itamar Turner-Trauring <itamar at itamarst.org> 写道:

> On 03/17/2012 09:01 PM, hz hanks wrote:
>> Hi, All
>>
>> I just started Twisted and I've a problem when using it. I want to
>> write a program for both the client and the server that the client can
>> download something from the server. Therefore, I want every client and
>> server pair can use multithread to download the different parts of the
>> files at the same time in order to increase the download speed. But I
>> just know how to send simple message between server and client, such
>> as protocol.Protocol.dataReceived. Any one can give me some advice.
>> Very appreciated!
>
> You don't need multiple threads to do multiple network operations (e.g.
> parallel downloads) in Twisted. Just run multiple client requests, e.g.
> by calling reactor.connectTCP multiple times.
>
> _______________________________________________
> 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