summaryrefslogtreecommitdiff
path: root/doc/zmq_recv.txt
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2010-05-31 17:21:51 +0200
committerMartin Lucina <mato@kotelna.sk>2010-05-31 17:21:51 +0200
commitb4f3e0acd72de97bc5ef46ea74d9cd7ed7f9efc2 (patch)
tree3a70fcbe2007049ae1a7727e209d50df84d8db3d /doc/zmq_recv.txt
parent7bbe754cb4987669d4273ec37f5f50d29b9931df (diff)
Documentation updates
Clarify multi-part messages
Diffstat (limited to 'doc/zmq_recv.txt')
-rw-r--r--doc/zmq_recv.txt16
1 files changed, 8 insertions, 8 deletions
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);
----