[zeromq-dev] Message initialisation

Pieter Hintjens ph at imatix.com
Thu May 1 19:50:39 CEST 2014


On Thu, May 1, 2014 at 6:35 PM, Lars Tandle Kyllingstad
<lars at kyllingen.net> wrote:

> ... it is set to the
> same state as after a successful zmq_msg_init() call.  Is this correct?

Yes.

> The zmq_msg_close() reference further says that a message does not need
> to be closed after a zmq_msg_send() call.  Presumably, this means that
> it is not necessary to close it after zmq_msg_init() either, provided it
> has not been used to receive a message in the meantime.  Correct?

Correct. Note the message is only nullified if zmq_msg_send() is successful.

> In other words, closing an empty message is apparently not a no-op.  So,
> what is the difference between an empty message and a closed message?

I don't think the difference is documented.

> And my final question:  Is zmq_msg_init_size(&m, 0) by definition
> equivalent to zmq_msg_init(&m)?  I have looked at the source code, and
> it seems the two cases are currently implemented in the same way, but my
> question is whether this is by specification, or whether it is an
> implementation detail that may change in future versions.

Not documented, so open for change. If you think this should be
formally specified, the right place would be the man pages, and if
it's critical, then in a test case as well.

> If anyone is interested in my work, check out:
>      https://github.com/kyllingstad/zmqd

Nice! See http://zeromq.org/docs:organization, it may be interesting to you.

-Pieter



More information about the zeromq-dev mailing list