[zeromq-dev] Vector transmission via REQ-REP. Am I missing something obvious?

James Chapman james at linux-101.org
Thu Apr 9 12:53:07 CEST 2015


-- In case this appears twice, sent again this time from the list
subscribed account --

Hello list

I could use some help... Using the REQ-REP model in C++ I'm trying to send
a vector, but failing miserably and I can't work out why. Maybe this will
never work? Maybe the idea of sending a vector is a bad and broken idea to
start with and I should instead be trying to send a fixed size? But then if
sending a vector is impossible, how do I send a variable amount of data?
Should I just be using large enough buffers to allow for my largest
expected data transfer? -This seems wasteful.

Guidance on this matter would be greatly appreciated.

I should add that failure is happening on the receiving end when trying to
read the vector field.

example (In this case TestMessage is a struct of what I want to send. If I
include a vector<int> field in TestMessage it fails.)

zmq::message_t * pZmqMsgOut = new zmq::message_t(sizeof(TestMessage));
memcpy((void *)pZmqMsgOut->data(), pTestMsg, sizeof(*pTestMsg));


Thanks in advance.
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150409/27052f98/attachment.htm>


More information about the zeromq-dev mailing list