[Twisted-Python] Create client in Server factory

Grégoire Leroy gregoire.leroy at retenodus.net
Wed Oct 31 03:14:34 EDT 2012


I have a server who receive data from clients A/B/C (remote machines). I want 
to use a client D (on the same machine than the server) to send this data to 
another server (remote).

The difficulty is, I want to use the same client D connection for any client. I 
don't want open an new connection each time.

First thing I would think is to create the connection in my server factory, 
and use client's methods in my server protocol, for example with
class LocalProxyFactory(Factory):
        def __init__(self):
                f = LocalProxyClientFactory()
                reactor.connectTCP("retenodus.net", 4242, f)
But in this case, code execution will stay in the reactor, right ?

I have read that :
But I don't know how it can be applied to my situation.

Grégoire Leroy

More information about the Twisted-Python mailing list