[zeromq-dev] Friendly IDs

Goswin von Brederlow goswin-v-b at web.de
Mon Sep 29 11:21:33 CEST 2014


On Sun, Sep 28, 2014 at 07:17:39PM -0700, Roberto Ostinelli wrote:
> Hello 0mq'ers!
> I'm investigating 0MQ and up until know I'm enjoying what I'm seeing.
> 
> As an academical exercise, I'm trying to understand how to build a simple server that can route a REQ to a very specific Socket based on a "friendly name", and receive a RES from it.
> 
> For instance, let's say I have two clients, "Tom" and "Jerry", that somehow authenticate on a server.
> I want to be able to have Tom send a REQ specifically to "Jerry", and receive a RES, via a server (i.e. not by a direct connection).
> 
> I've seen the examples on how to create a QUEUE device to route XREQ and XRES, however in these examples there are clients on one side and servers on the other, and when a client sends a request, any server on the other side can provide the response. I'd like to have a way for the client "Tom" to specify that it wants its response from the server "Jerry".
> 
> Can a kind soul point me in the right direction?
> 
> Thank you in advance.
> r.

What I do in my code is to use the same syntax as ROUTER sockets. You
send the recipient "Jerry" as first frame of the message and have the
QUEUE device use that frame to direct the rest of the message. In my
case the outgoing end is a ROUTER socket to I just pass the whole
message on, including the recipient frame and the ROUTER socket sends
it the right way.

MfG
	Goswin



More information about the zeromq-dev mailing list