i have tried just storing them but have encountered corrupted contents later. i will assume for now that is me, as it should work...
On Sep 19, 2012, at 5:31 PM, Apostolis Xekoukoulotakis wrote: > I would also like to know. I treat msgs as immutable memory in order to avoid > mallocing, memcpying. > > 2012/9/19 Sideropoulos, Alexander <[email protected]> > 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 > [email protected] > > > > On Wed, Sep 19, 2012 at 9:15 AM, Andrew Hume <[email protected]> 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 > [email protected] (Work) +1 973-236-2014 > AT&T Labs - Research; member of USENIX and LOPSA > > > > > > _______________________________________________ > 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 > > > > > -- > > Sincerely yours, > Apostolis Xekoukoulotakis > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ------------------ Andrew Hume (best -> Telework) +1 623-551-2845 [email protected] (Work) +1 973-236-2014 AT&T Labs - Research; member of USENIX and LOPSA
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
