[zeromq-dev] How to reuse zmq_msg_t

Uli Köhler ulikoehler.dev at googlemail.com
Thu Jul 11 01:11:46 CEST 2013

I have a function that reads a multipart message from one socket and
immediately proxies it to another socket (not using CZMQ).

Currently I declare one zmq_msg_t on the stack and initialize it once
(zmq_msg_init) before the first receive. However, I'm not sure about
whether I have to call zmq_msg_init() after each zmq_msg_send() before
another zmq_msg_recv() on the same stack-allocated zmq_msg_t.

The zmq_msg_send() reference states it "nullifies" the message, the ZMQ
guide says it "sets its size to zero".

It "nullification" equivalent to what zmq_msg_init does, so I don't have to
call zmq_msg_init() again?

Thanks in advance!

Best regards,
Uli Köhler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130711/50c353b6/attachment.htm>

More information about the zeromq-dev mailing list