On Tue, Sep 28, 2010 at 04:38, Pieter Hintjens <[email protected]> wrote:

> Except it does not work, when you send m1 m2 is also cleared.
>
change:

> zmq_msg_copy (msg2, msg1);
> zmq_send (s1, msg1);
> zmq_send (s2, msg2);
>

to:
zmq_msg_copy (msg2, msg1);
zmq_send (s2, msg2);
zmq_send (s1, msg1);

and it should work.  Still probably a bug, but this might help track it
down.



 On 28 Sep 2010 13:14, "Martin Sustrik" <[email protected]> wrote:
> > 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
>
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to