From eb9ff1e77977c6199c0a0439f4dd35fa39f3bd3c Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 31 May 2010 14:12:27 +0200 Subject: Documentation updates Multi-part messages --- doc/zmq_send.txt | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'doc/zmq_send.txt') diff --git a/doc/zmq_send.txt b/doc/zmq_send.txt index 927bc1b..b05c73b 100644 --- a/doc/zmq_send.txt +++ b/doc/zmq_send.txt @@ -23,12 +23,34 @@ Specifies that the operation should be performed in non-blocking mode. If the message cannot be queued on the underlying _message queue_ associated with 'socket', the _zmq_send()_ function shall fail with 'errno' set to EAGAIN. +*ZMQ_SNDMORE*:: +Specifies that the message being sent is a multi-part message, and that further +message parts are to follow. Refer to the section regarding multi-part messages +below for a detailed description. + NOTE: A successful invocation of _zmq_send()_ does not indicate that the message has been transmitted to the network, only that it has been queued on the _message queue_ associated with the socket and 0MQ has assumed 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. Consequently, wherever this +documentation uses the term _message_ it may be substituted for _message part_. + +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 +that the message being sent is a multi-part message and that more message parts +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. The total number of mess + +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 ------------ The _zmq_send()_ function shall return zero if successful. Otherwise it shall @@ -47,7 +69,7 @@ to the socket not being in the appropriate state. This error may occur with socket types that switch between several states, such as ZMQ_REP. See the _messaging patterns_ section of linkzmq:zmq_socket[3] for more information. *ETERM*:: -The associated context was terminted. +The 0MQ 'context' associated with the specified 'socket' was terminated. EXAMPLE @@ -65,6 +87,15 @@ rc = zmq_send (socket, &msg, 0); assert (rc == 0); ---- +.Sending a multi-part message +---- +/* Send a multi-part message consisting of three parts to socket */ +rc = zmq_send (socket, &part1, ZMQ_SNDMORE); +rc = zmq_send (socket, &part2, ZMQ_SNDMORE); +/* Final part; no more parts to follow */ +rc = zmq_send (socket, &part3, 0); +---- + SEE ALSO -------- -- cgit v1.2.3