[zeromq-dev] is this allowed?
Sideropoulos, Alexander
alexander at thequery.net
Wed Sep 19 19:13:47 CEST 2012
There are examples in the Guide where a zmq_msg_t is received and then the
same variable is later used in a zmq_msg_send() call. So I assume this
usage is acceptable (assuming no differences in behaviour to the version
you are using).
obvious things to check:
- be careful to not muck around with the buf array after calling
zmq_msg_send()
- receiving/sending multipart messages
- return values of zmq calls
Cheers.
--------------------
Alexander Sideropoulos
alexander at thequery.net
On Wed, Sep 19, 2012 at 9:15 AM, Andrew Hume <andrew at research.att.com>wrote:
> i have a situation where i sometimes store messages for a while before
> sending on.
> is this code safe (in terms of message handling)?
>
> zmq_msg_t msg, buf[2000];
>
> zmq_msg_init(&msg);
> zmq_recv(sock, &msg, 0);
> if(cond)
> buf[i++] = msg;
> else
> zmq_msg_close(&msg);
>
> ...
>
> for(j = 0; j < i; j++){
> zmq_send(osock, &buf[j], 0);
> zmq_msg_close(&buf[j]);
> }
>
> initial evidence indicates stuff is happening behind my back but before i
> spend
> a lot of time debugging that, i wanted to ensure that this is even
> possible.
>
> thanks
>
>
>
> ------------------
> Andrew Hume (best -> Telework) +1 623-551-2845
> andrew at research.att.com (Work) +1 973-236-2014
> AT&T Labs - Research; member of USENIX and LOPSA
>
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120919/1b8c82ba/attachment.htm>
More information about the zeromq-dev
mailing list