From b4f3e0acd72de97bc5ef46ea74d9cd7ed7f9efc2 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 31 May 2010 17:21:51 +0200 Subject: Documentation updates Clarify multi-part messages --- doc/zmq_recv.txt | 16 ++++++++-------- doc/zmq_send.txt | 13 ++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'doc') diff --git a/doc/zmq_recv.txt b/doc/zmq_recv.txt index 50be810..42df99a 100644 --- a/doc/zmq_recv.txt +++ b/doc/zmq_recv.txt @@ -31,10 +31,12 @@ to EAGAIN. Multi-part messages ~~~~~~~~~~~~~~~~~~~ -A 0MQ message is composed of 1 to N message parts; each message part is an -independent 'zmq_msg_t' in its own right. The total number of message parts is -unlimited. Consequently, wherever this documentation uses the term _message_ it -may be substituted for _message part_. +A 0MQ message is composed of 1 or more message parts; each message part is an +independent 'zmq_msg_t' in its own right. 0MQ ensures atomic delivery of +messages; peers shall receive either all _message parts_ of a message or none +at all. + +The total number of message parts is unlimited. An application wishing to determine if a message is composed of multiple parts does so by retrieving the value of the _ZMQ_RCVMORE_ socket option on the @@ -43,9 +45,6 @@ follow, or if the message is not composed of multiple parts, _ZMQ_RCVMORE_ shall report a value of zero. Otherwise, _ZMQ_RCVMORE_ shall report a value of 1, indicating that more message parts are to follow. -0MQ shall ensure the atomicity of a multi-part message; peers shall receive -either all _message parts_ of a multi-part message or none at all. - RETURN VALUE ------------ @@ -84,6 +83,7 @@ assert (rc == 0); .Receiving a multi-part message ---- int64_t more; +int64_t more_size = sizeof more; do { /* Create an empty 0MQ message to hold the message part */ zmq_msg_t part; @@ -93,7 +93,7 @@ do { rc = zmq_recv (socket, &part, 0); assert (rc == 0); /* Determine if more message parts are to follow */ - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, sizeof more); + rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); assert (rc == 0); } while (more); ---- diff --git a/doc/zmq_send.txt b/doc/zmq_send.txt index e4439f5..300f812 100644 --- a/doc/zmq_send.txt +++ b/doc/zmq_send.txt @@ -36,10 +36,12 @@ responsibility for the message. Multi-part messages ~~~~~~~~~~~~~~~~~~~ -A 0MQ message is composed of 1 to N message parts; each message part is an -independent 'zmq_msg_t' in its own right. The total number of message parts is -unlimited. Consequently, wherever this documentation uses the term _message_ it -may be substituted for _message part_. +A 0MQ message is composed of 1 or more message parts; each message part is an +independent 'zmq_msg_t' in its own right. 0MQ ensures atomic delivery of +messages; peers shall receive either all _message parts_ of a message or none +at all. + +The total number of message parts is unlimited. An application wishing to send a multi-part message does so by specifying the 'ZMQ_SNDMORE' flag to _zmq_send()_. The presence of this flag indicates to 0MQ @@ -48,9 +50,6 @@ are to follow. When the application wishes to send the final message part it does so by calling _zmq_send()_ without the 'ZMQ_SNDMORE' flag; this indicates that no more message parts are to follow. -0MQ shall ensure the atomicity of a multi-part message; peers shall receive -either all _message parts_ of a multi-part message or none at all. - RETURN VALUE ------------ -- cgit v1.2.3