简体   繁体   中英

Python/Twisted - Server also a client?

Basically, I have a twisted server accepting data from clients, which works great. What I'd like this server to do is send certain received data to another server, which will then echo it to everything connected to it(essentially sharing data between multiple servers using a central hub.) So as a simple idea:

Data -> Server1 -> Central Server -> Connected clients(Server1, Server2, Server3, etc;)

Any ideas on how this could be achieved? I've been told calling

reactor.connect(host, port)

inside the server function will create a client, but how can I share the data between the server and the client? Is there a way to call the clients sendLine from within the servers dataReceived?

看看如何在Twisted中实现代理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM