[Twisted-Python] is it possible to have a (single) twisted client that
exarkun at divmod.com
Thu Jan 26 23:44:03 EST 2006
On Thu, 26 Jan 2006 20:27:34 -0800 (PST), john peter <neuzhoundxx at yahoo.com> wrote:
> makes more than one (say, three) connections to the same server instance?
> i was thinking of something like this: an 'ADD' connection that sends new data items to the server for saving, an 'UPDATE' connection that sends data update requests, and a 'DELETE' connection that sends data deletion requests. All three connections share DATA ID information, but should otherwise have "independent" existence so that they can be configured to have different "behavioral" attributes; that is, the ADD connection saves the data ids for items successfully persisted to an 'in-memory' table for later lookups, and UPDATE and DELETE requests can only be issued for DATA IDs known to be valid for the "current" session (thus, the "in-memory" table lookups) and each connection may have attributes such as "send" rates, etc.
> If this is possible, could someone please give me some pointers on what twisted code to study/ look at? thank you very much for your help!
This is as easy as calling reactor.connectTCP() three times. There's nothing special about the first call, or the second call, or the third call. Each one just sets up a connection attempt.
Try taking echoclient.py from the core examples and adding some more connectTCP calls to it, see what happens.
More information about the Twisted-Python