On 09/28/2010 12:14 PM, Pieter Hintjens wrote:
> On Tue, Sep 28, 2010 at 12:03 PM, MinRK<[email protected]>  wrote:
>
>> You said that zmq_msg_copy doesn't create a resendable copy?
>> I'm not sure exactly what you mean, but you can definitely (I do) send a
>> message twice if you do zmq_msg_copy. Here's what I learned: you must send
>> the *copy* first, because if you send the original first, it can clear the
>> buffer before the copy asks for the data, but sending the copy first is
>> safe.
>
> That seems to rely on totally undocumented behavior.  Actually I've no
> idea what zmq_msg_copy is for...  Martin, can you enlighten us?

It can be used when you want to send same message to multiple sockets.

... fill in msg1 here ...
zmq_msg_copy (msg2, msg1);
zmq_send (s1, msg1);
zmq_send (s2, msg2);

Martin
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to