[Twisted-Python] How can a tcp client connect with multi servers?

Xu Ryan xuryans at gmail.com
Wed Dec 14 20:17:02 EST 2005


hi, I use a pool for connect task, and recall it in some seconds. I
write some simple codes below to explain my idea, but i have not run
it, so just read it do not run it:)

from Queue import Queue

TaskQueue = Queue()

def sendTcp(addr, port, message):
    global TaskQueue
    TaskQueue.put((addr, port, message))

def __send():
    global TaskQueue
    while not TaskQueue.empty():
         addr, port, message = TaskQueue.pop()
         reactor.connectTCP(addr, port, FooFactory(message))

    reactor.callLater(15, __send)

if __name__ == "__main__":
    reactor.callLater(15, __send)
    reactor.run()

I'm appreciate to listen any advice
On 12/12/05, Khoa Nguyen <khoa.coffee at gmail.com> wrote:
>
> Hi Xu,
>
> How did you solve this problem? I face a similar issue and would appreciate
> if you post a working sample code
>
> Thanks,
> Khoa
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
>


--
Xu Ryans




More information about the Twisted-Python mailing list