1ZMQ_MSG_COPY(3) 0MQ Manual ZMQ_MSG_COPY(3)
2
3
4
6 zmq_msg_copy - copy content of a message to another message
7
9 int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
10
12 The zmq_msg_copy() function shall copy the message object referenced by
13 src to the message object referenced by dest. The original content of
14 dest, if any, shall be released. You must initialise dest before
15 copying to it.
16
17 Caution
18 The implementation may choose not to physically copy the message
19 content, rather to share the underlying buffer between src and
20 dest. Avoid modifying message content after a message has been
21 copied with zmq_msg_copy(), doing so can result in undefined
22 behaviour. If what you need is an actual hard copy, initialize a
23 new message using zmq_msg_init_buffer() with the message content.
24
25 Caution
26 Never access zmq_msg_t members directly, instead always use the
27 zmq_msg family of functions.
28
30 The zmq_msg_copy() function shall return zero if successful. Otherwise
31 it shall return -1 and set errno to one of the values defined below.
32
34 EFAULT
35 Invalid message.
36
38 Copying a message.
39
40 zmq_msg_t msg;
41 zmq_msg_init_buffer (&msg, "Hello, World", 12);
42 zmq_msg_t copy;
43 zmq_msg_init (©);
44 zmq_msg_copy (©, &msg);
45 ...
46 zmq_msg_close (©);
47 zmq_msg_close (&msg);
48
49
51 zmq_msg_move(3) zmq_msg_init(3) zmq_msg_init_size(3)
52 zmq_msg_init_buffer(3) zmq_msg_init_data(3) zmq_msg_close(3) zmq(7)
53
55 This page was written by the 0MQ community. To make a change please
56 read the 0MQ Contribution Policy at
57 http://www.zeromq.org/docs:contributing.
58
59
60
610MQ 4.3.4 07/23/2021 ZMQ_MSG_COPY(3)