[zeromq-dev] Trouble sending from ROUTER to DEALER

Chad Koski chad at koski.com
Tue Sep 16 16:52:22 CEST 2014


Your line is actually getting the size of the pointer to the data, not the size of the data.  That will always be 4 bytes (in your case) as that’s how big a pointer is.  On a 64 bit system it will always be 8 bytes.

sizeof void*  is what your size calculation line is doing.  (zmq_msg_data() returns a void*)


On Sep 16, 2014, at 10:19 AM, Riskybiz <riskybizlive at live.com> wrote:

> Apologies, I should have included the line I had used to determine the size
> of the identity: 
> 
> "size_t id_size = (sizeof zmq_msg_data(&messageIn));//size in bytes"
> 
> I think this is the size of the data payload of the zmq_msg_t object, but
> perhaps it is the size of the pointer returned from
> zmq_msg_data(&messageIn)?
> 
> Whereas your line is:
> 
> "printf("identity frame size: %ld bytes\n", zmq_msg_size(&messageIn));"
> 
> When run on my system I concur that your line gives output of "5 bytes".
> 
> router: Preparing
> router: Ready to receive
> identity frame size: 5 bytes
> --------------------------- Message Received ---------------------------
> Originator Identity: 32768 Identity Message Data Payload: 4bytes or 32bits
> Frame Vector Index: 0 Frame Data: Frame1
> Frame Vector Index: 1 Frame Data: Frame2
> Frame Vector Index: 2 Frame Data: Frame3
> Frame Vector Index: 3 Frame Data: Frame4
> Frame Vector Index: 4 Frame Data: Frame5
> ------------------------------------------------------------------------
> MultiPartMessage: Sending to connection identity: 32768 Size of identity:
> 4bytes
> or: 32bits
> router: Ready to receive
> 
> Though I'm not sure how to use this information to make the example function
> as intended.
> 
> I also tried added a blank message frame after the identity frame as
> suggested by Rodrigo Mosconi, but that did not fix the problem.  I was
> working under the impression that any sequence of zmq_msg_t objects could be
> sent via a ROUTER socket so long as the identity of the destination was the
> first frame?  Also that the 'blank' frame was necessary for certain socket
> types only e.g. REQ-REP?
> 
> Thanks,
> 
> Riskybiz.
> 
> _______________________________________________
> 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