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

gx1986 at mail.ustc.edu.cn gx1986 at mail.ustc.edu.cn
Sat Sep 19 23:03:07 EDT 2009


I will try.
Thank you very much!


> -----Original E-mail-----
> From: exarkun at twistedmatrix.com
> Sent Time: 2009-9-20 0:06:37
> To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
> Cc: 
> Subject: Re: [Twisted-Python] What is the difference in
	between	reactor.running and reactor._stopped
> 
> 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 
> >file.
> >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.connectTCP(HOST,PORT,TSClientFactory(filename)) 
> >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 
> suggestions.
> 
> 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.
> 
> Jean-Paul
> 
> _______________________________________________
> 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