mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-19 18:03:50 +00:00
Documentation updates
Clarify multi-part messages
This commit is contained in:
parent
7bbe754cb4
commit
b4f3e0acd7
@ -31,10 +31,12 @@ to EAGAIN.
|
|||||||
|
|
||||||
Multi-part messages
|
Multi-part messages
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
A 0MQ message is composed of 1 to N message parts; each message part is an
|
A 0MQ message is composed of 1 or more message parts; each message part is an
|
||||||
independent 'zmq_msg_t' in its own right. The total number of message parts is
|
independent 'zmq_msg_t' in its own right. 0MQ ensures atomic delivery of
|
||||||
unlimited. Consequently, wherever this documentation uses the term _message_ it
|
messages; peers shall receive either all _message parts_ of a message or none
|
||||||
may be substituted for _message part_.
|
at all.
|
||||||
|
|
||||||
|
The total number of message parts is unlimited.
|
||||||
|
|
||||||
An application wishing to determine if a message is composed of multiple parts
|
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
|
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
|
shall report a value of zero. Otherwise, _ZMQ_RCVMORE_ shall report a value of
|
||||||
1, indicating that more message parts are to follow.
|
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
|
RETURN VALUE
|
||||||
------------
|
------------
|
||||||
@ -84,6 +83,7 @@ assert (rc == 0);
|
|||||||
.Receiving a multi-part message
|
.Receiving a multi-part message
|
||||||
----
|
----
|
||||||
int64_t more;
|
int64_t more;
|
||||||
|
int64_t more_size = sizeof more;
|
||||||
do {
|
do {
|
||||||
/* Create an empty 0MQ message to hold the message part */
|
/* Create an empty 0MQ message to hold the message part */
|
||||||
zmq_msg_t part;
|
zmq_msg_t part;
|
||||||
@ -93,7 +93,7 @@ do {
|
|||||||
rc = zmq_recv (socket, &part, 0);
|
rc = zmq_recv (socket, &part, 0);
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
/* Determine if more message parts are to follow */
|
/* 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);
|
assert (rc == 0);
|
||||||
} while (more);
|
} while (more);
|
||||||
----
|
----
|
||||||
|
@ -36,10 +36,12 @@ responsibility for the message.
|
|||||||
|
|
||||||
Multi-part messages
|
Multi-part messages
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
A 0MQ message is composed of 1 to N message parts; each message part is an
|
A 0MQ message is composed of 1 or more message parts; each message part is an
|
||||||
independent 'zmq_msg_t' in its own right. The total number of message parts is
|
independent 'zmq_msg_t' in its own right. 0MQ ensures atomic delivery of
|
||||||
unlimited. Consequently, wherever this documentation uses the term _message_ it
|
messages; peers shall receive either all _message parts_ of a message or none
|
||||||
may be substituted for _message part_.
|
at all.
|
||||||
|
|
||||||
|
The total number of message parts is unlimited.
|
||||||
|
|
||||||
An application wishing to send a multi-part message does so by specifying the
|
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
|
'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
|
does so by calling _zmq_send()_ without the 'ZMQ_SNDMORE' flag; this indicates
|
||||||
that no more message parts are to follow.
|
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
|
RETURN VALUE
|
||||||
------------
|
------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user