[Twisted-Python] What is the difference in between reactor.running and reactor._stopped

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sat Sep 19 12:06:37 EDT 2009

On 02:33 am, gx1986 at mail.ustc.edu.cn wrote:
>Ok,let me express what i want to do clearly.
>I use twisted to transfer a file.What i do is to open a file in 
>client,then transfer it by TCP.Server received it and write it into a 
>The filename in 
>"reactor.connectTCP(HOST,PORT,TSClientFactory(filename))" is  what i 
>want to transfer.
>If i want to transfer two file,what i do is to write 
>reactor.run(installSignalHandlers=0)" twice.But this will be error 
>which you have told me. Now how could i to solve this problem?

You have to solve it by only calling reactor.run once.
>Meanwhile,if transfered file is big,the server's "dataReceived" 
>function will run several times to receive all the data.If i transfer 
>all of files one time,using 
>"reactor.connectTCP(HOST,PORT,TSClientFactory(filenameList))". It will 
>be hard to distinguish these different files,because "dataReceived" 
>just receive.

You have to use a protocol which lets you distinguish between different 
files.  I'm not sure what "TS" is so I can't make any specific 

Another possibility is to keep using multiple connections.  You can call 
reactor.connectTCP as many times as you want.  It's only reactor.run 
that can only be called once.


More information about the Twisted-Python mailing list