On 02:33 am, gx1...@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@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python