On Tue, Apr 5, 2011 at 10:44 AM, Martin Sustrik <[email protected]> wrote:
> The problem is that people are already using XREP socket as a router, ie. > 1. You have 3 apps you want to send arbitrary messages to. > 2. You create an XREQ socket in each of them. Then you set the > identities on those socket to "A", "B" and "C" respectively. > 3. The sender application creates an XREP socket and connects to those > three applications. When you want to send message to first app, you > simply prepend the message by "A", if you want to send it to the second > app, you prepend it by "B" etc. I'd like to point out that there is no inherent link between using explicit identities and using the router socket. You're perhaps confused by some of the examples in the Guide which set client identities; they do that for tracing and to help understanding, not for functional reasons. Almost all real use cases for ROUTER work with automatic identities. There is one exception I've found, which is doing ROUTER-to-ROUTER work, which does happen, see the Freelance pattern. Here, one side *must* specify an explicit identity, otherwise neither can ever talk to the other. The solution is that the 'stable' peer (the server) sets its identity to its connection endpoint, which absolves the client of knowing an extra random string. It also avoids the problem of resource depletion on the server, since clients still have only automatic identities. I'd suggest that stable nodes need to be protected against any resource depletion caused by malicious or flawed clients. This includes identities. Maybe, setting an explicit identity should be possible only on a socket that is bound, not on a connected socket. (I know that in some cases stable nodes connect to unstable ones, but that's exceptional and confusing.) Hope this helps. -Pieter _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
