[zeromq-dev] How to reuse zmq_msg_t

Pieter Hintjens pieterh at gmail.com
Thu Jul 11 12:34:51 CEST 2013


Yes, after sending the message it is initialized to empty as per
zmq_msg_init.
On Jul 11, 2013 1:11 AM, "Uli Köhler" <ulikoehler.dev at googlemail.com> wrote:

> Hi,
> 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
>
> _______________________________________________
> 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/20130711/d08e42ab/attachment.htm>


More information about the zeromq-dev mailing list