[zeromq-dev] is this allowed?
Apostolis Xekoukoulotakis
xekoukou at gmail.com
Thu Sep 20 02:31:34 CEST 2012
I would also like to know. I treat msgs as immutable memory in order to
avoid mallocing, memcpying.
2012/9/19 Sideropoulos, Alexander <alexander at thequery.net>
> 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
>>
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
--
Sincerely yours,
Apostolis Xekoukoulotakis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120920/48243210/attachment.htm>
More information about the zeromq-dev
mailing list