1ZMQ_SEND_CONST(3)                 0MQ Manual                 ZMQ_SEND_CONST(3)
2
3
4

NAME

6       zmq_send_const - send a constant-memory message part on a socket
7

SYNOPSIS

9       int zmq_send_const (void *socket, const void *buf, size_t len, int
10       flags);
11

DESCRIPTION

13       The zmq_send_const() function shall queue a message created from the
14       buffer referenced by the buf and len arguments. The message buffer is
15       assumed to be constant-memory and will therefore not be copied or
16       deallocated in any way. The flags argument is a combination of the
17       flags defined below:
18
19       ZMQ_DONTWAIT
20           For socket types (DEALER, PUSH) that block (either with
21           ZMQ_IMMEDIATE option set and no peer available, or all peers having
22           full high-water mark), specifies that the operation should be
23           performed in non-blocking mode. If the message cannot be queued on
24           the socket, the zmq_send_const() function shall fail with errno set
25           to EAGAIN.
26
27       ZMQ_SNDMORE
28           Specifies that the message being sent is a multi-part message, and
29           that further message parts are to follow. Refer to the section
30           regarding multi-part messages below for a detailed description.
31
32           Note
33           A successful invocation of zmq_send_const() does not indicate that
34           the message has been transmitted to the network, only that it has
35           been queued on the socket and 0MQ has assumed responsibility for
36           the message.
37
38   Multi-part messages
39       A 0MQ message is composed of 1 or more message parts. 0MQ ensures
40       atomic delivery of messages: peers shall receive either all message
41       parts of a message or none at all. The total number of message parts is
42       unlimited except by available memory.
43
44       An application that sends multi-part messages must use the ZMQ_SNDMORE
45       flag when sending each message part except the final one.
46

RETURN VALUE

48       The zmq_send_const() function shall return number of bytes in the
49       message if successful. Otherwise it shall return -1 and set errno to
50       one of the values defined below.
51

ERRORS

53       EAGAIN
54           Non-blocking mode was requested and the message cannot be sent at
55           the moment.
56
57       ENOTSUP
58           The zmq_send_const() operation is not supported by this socket
59           type.
60
61       EFSM
62           The zmq_send_const() operation cannot be performed on this socket
63           at the moment due to the socket not being in the appropriate state.
64           This error may occur with socket types that switch between several
65           states, such as ZMQ_REP. See the messaging patterns section of
66           zmq_socket(3) for more information.
67
68       ETERM
69           The 0MQ context associated with the specified socket was
70           terminated.
71
72       ENOTSOCK
73           The provided socket was invalid.
74
75       EINTR
76           The operation was interrupted by delivery of a signal before the
77           message was sent.
78
79       EHOSTUNREACH
80           The message cannot be routed.
81

EXAMPLE

83       Sending a multi-part message.
84
85           /* Send a multi-part message consisting of three parts to socket */
86           rc = zmq_send_const (socket, "ABC", 3, ZMQ_SNDMORE);
87           assert (rc == 3);
88           rc = zmq_send_const (socket, "DEFGH", 5, ZMQ_SNDMORE);
89           assert (rc == 5);
90           /* Final part; no more parts to follow */
91           rc = zmq_send_const (socket, "JK", 2, 0);
92           assert (rc == 2);
93
94

SEE ALSO

96       zmq_send(3) zmq_recv(3) zmq_socket(7) zmq(7)
97

AUTHORS

99       This page was written by the 0MQ community. To make a change please
100       read the 0MQ Contribution Policy at
101       http://www.zeromq.org/docs:contributing.
102
103
104
1050MQ 4.3.4                         07/23/2022                 ZMQ_SEND_CONST(3)
Impressum