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 <nixch...@gmail.com>

Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER

To: ZeroMQ development list <zeromq-dev@lists.zeromq.org>

Message-ID:

 
<CAP2skc-a8DXP+v2UhLoo=7c8dCoBk6K69zZVX=6lpszknrn...@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/a
ttachment-0001.htm 

 

------------------------------

 

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to