[zeromq-dev] java server (DEALER) + worker / c client (REQ)

Michel Pelletier pelletier.michel at gmail.com
Thu Sep 27 18:20:28 CEST 2012


You need to set the identify before the connect, as you did in the Java version.

-Michel

On Thu, Sep 27, 2012 at 8:40 AM, Davis Ford <davisford at gmail.com> wrote:
> Hi, I'm trying to get some variation of a DEALER / REQ pattern, where the
> server (in java) dispatches messages to worker threads.
>
> Similar to the example here (Java) => http://zguide.zeromq.org/java:tripping
> Same example here (C) => http://zguide.zeromq.org/c:tripping
>
> Except I have a Java server with workers and a C client.
>
> My code is here: http://pastebin.com/K483HAJY
>
> The C client will connect to the frontend socket and does a synchronous
> write, the write is received, the address frame popped off, and a new
> address frame is pushed on for the backend worker.  The backend worker
> thread receives the msg, it pops off the address frame and pushes on a new
> "C" identity frame, and tries to send to the frontend socket.
>
> Unfortunately, the client never receives a reply.  I had thought that if I
> do this:
>
> void *client = = zsocket_new(ctx, ZMQ_REQ);
> zsocket_connect(client, "server-url");
> zsocket_set_identity(client, "C");
>
> Then this would have the effect of pushing an identity frame on all outgoing
> messages on that socket, which should be the "C" character, but if I print
> the messages on the server side, this is what I see:
>
> waiting to receive on frontend...got a message on frontend...
>    popped address frame: 00800041A7
>    pushed 'W' address frame and sending to backend..
>
> received message on worker:org.zeromq.ZMsg at 5db0531
>
> waiting to receive on backend...got a message on backend...
>    popped address frame: W
>    pushed 'C' address frame and sending to frontend..
>
> It seems the address frame coming in on the client is some random number,
> not "C", so I'm guessing this is why the client never receives a response.
> What am I doing wrong?
>
> Thanks in advance
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list