[zeromq-dev] Trouble sending from ROUTER to DEALER
Pieter Hintjens
ph at imatix.com
Wed Sep 17 20:39:55 CEST 2014
It is fairly simple:
- use CZMQ and switch from C++ to C (:-)
- use zframe_recv or zmsg_recv and zmsg_pop
-Pieter
On Wed, Sep 17, 2014 at 6:26 PM, Riskybiz <riskybizlive at live.com> wrote:
> Ok. I’ve been trying to get those 5 bytes of the ROUTER generated
> “identity” into a C++ variable so that it can be stored in memory and used
> to prepend an outbound message at some later time. Can anyone suggest how
> the identity data stored in a zmq_msg_t object and pointed to by:
>
>
>
> zmq_msg_data(&messageIn)
>
>
>
> could be stored in a variable which;
>
>
>
> 1. Is easily printable on the console.
>
> 2. Can be simply copied into a zmq_msg_t object to form the identity
> frame of a message sent via a ROUTER socket.
>
> 3. Works without knowing that auto generated identities are of any
> specific size.
>
>
>
> Stuck.
>
>
>
> Riskybiz.
>
>
>
> Date: Tue, 16 Sep 2014 22:45:52 +0800
>
> From: KIU Shueng Chuan <nixchuan at gmail.com>
>
> Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER
>
> To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>
>
> Message-ID:
>
>
> <CAP2skc-a8DXP+v2UhLoo=7c8dCoBk6K69zZVX=6LpsZKNRnckw at mail.gmail.com>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
> In your multipartmsg.h file, you have code that does the following:
>
> int32_t id = *(static_cast<int*>(zmq_msg_data(&messageIn)))
>
>
>
> You have assumed that the auto generated identity is 4 bytes long, whereas
> it is in fact 5 bytes long.
>
> So when sending a reply, you would have sent a truncated identity, which the
> router socket know nothing about.
>
>
>
> More generally, you shouldn't need to write your code to "know" that auto
> generated identities are of any specific size.
>
> -------------- next part --------------
>
> An HTML attachment was scrubbed...
>
> URL:
> http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140916/3819b97f/attachment-0001.htm
>
>
>
> ------------------------------
>
>
>
>
> _______________________________________________
> 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