[zeromq-dev] Trouble sending from ROUTER to DEALER
KIU Shueng Chuan
nixchuan at gmail.com
Thu Sep 18 17:23:32 CEST 2014
Here's a simple zmq router example using the same endpoint as your
zmqrouter.cpp
https://gist.github.com/pijyoi/9088034e36f85e0c0aac
https://github.com/pijyoi/msg_parts/blob/master/msg_parts.hpp
On Thu, Sep 18, 2014 at 12:26 AM, 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140918/c11ae6b1/attachment.htm>
More information about the zeromq-dev
mailing list