[zeromq-dev] conventions in bindings
john skaller
skaller at users.sourceforge.net
Wed Feb 1 02:48:26 CET 2012
On 01/02/2012, at 11:22 AM, MinRK wrote:
> On Tue, Jan 31, 2012 at 15:43, john skaller <skaller at users.sourceforge.net> wrote:
> On 01/02/2012, at 9:17 AM, MinRK wrote:
> I would use terms like:
>
> MessageContainer: the zmq object
> MessageBuffer: the char array which might be used to hold a message
> Message: the actual bytes of user data
> MessagePart: some of the actual bytes of user data.
>
> Even this is a bit confusing to me. I don't see what the difference is between Message and MessageContainer, as zmq itself has no such object- it is strictly implied from the use of SND/RCVMORE flags. I do like the clarity of MessagePart as the name for a segment of a message, avoiding ambiguity of Message and apparently of Frame as well.
A message is a conceptual thing represented by a sequence of bytes: something that can be
sent along a wire or stored. ZMQ's zmq_msg_t is not a message in that sense, its an object
which can *hold* a message. I say "can" because when you initialise one with zmq_init,
it isn't holding a message, and there is no buffer either. When you use zmq_init_size,
there is a message contaning object with a buffer to hold a message .. but there
still isn't a message in there.
When you use recv, or when you use zmq_msg_init_data, then the buffer actually
holds a message. The zmq_msg_t object owns the buffer containing the message.
So the ZMQ terminology is rather confusing, since a zmq_msg_t is not a message,
nor is the buffer, if any, associated with it a message. The message is the
client data that is stored in the buffer associated with the zmq_msg_t object.
A zmq_msg_t object is more like a mail box: something into which you can
put a message. The message that gets put in there is in an envelope,
which is like the buffer holding the message.
Down the wire, the envelope is the framing, in memory the envelope is the
char array.
So actually .. writing this ... the *right* name for zmq_msg_t is probably
zmq_msg_box_t.
YMMV :)
--
john skaller
skaller at users.sourceforge.net
More information about the zeromq-dev
mailing list