[zeromq-dev] how to receive a message into a static buffer?
Aamir M
intuitionist at gmail.com
Mon May 4 15:26:18 CEST 2009
Hello,
I would like to receive a message into a pre-allocated buffer. I tried the
following:
void* buffer = &mybuffer;
zmq::message_t msg( buffer, sizeof(T), NULL );
api-> receive( &msg, true );
assert( msg.data() == datap ); // fails here
I have to resort to a memcpy:
zmq::message_t msg();
api-> receive( &msg, true );
memcpy( &mybuffer, msg.data(), sizeof(T) );
I want to avoid the copy and I must have the message data in the static
buffer. Is this possible?
Thanks,
Aamir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090504/831909ca/attachment.htm>
More information about the zeromq-dev
mailing list