[zeromq-dev] Java to C++: junk appended to message?

Pieter Hintjens ph at imatix.com
Mon Aug 30 21:06:22 CEST 2010

On Mon, Aug 30, 2010 at 9:00 PM, Jon Dyte <jon at totient.co.uk> wrote:

> i don't think it should add bytes either.

Well, it would be invisible and the only side-effect be 1 extra byte
of allocated memory, and the ability to pass message data to printf
safely if it's character data...

> and there is an option to allocate the buffer yr self and supply a free
> function. which would break with this?

Nope, this idea is for received messages, not sent messages.

I've been playing with this in ZFL blobs and it's really quite nice.
It lets you treat strings as character sequences without terminating

The alternative (as in Naveen's example case) is to either send an
extra null (which is not portable) or else copy the string on
reception (which is extra work)...


More information about the zeromq-dev mailing list