[zeromq-dev] epgm / pgm / auto discovery in C++ on Windows and VS2013

James Chapman james at linux-101.org
Thu Nov 27 19:38:38 CET 2014

Thanks Bob

> 1) why the "+1" at the end of the zmqMsgOut setup? Messages are not null
> terminated (though you can make them that way).

Thinking about it now this may have been a misunderstanding right from
the beginning although I now can't work out how I came to think it was
required. I'll remove that. Thanks.

> 2) the zmqMsgOut size parameter should be the length of the string, which is
> not sizeof(szMessageData). Use szMessageData.length().
> 3) for the memcpy() line, you are using sizeof() on the string, which is not
> the same as the string length, which is what you want.
>     Try this: memcpy((void*)zmqMsgOut.data(), szMessageData.data(),
> szMessageData,length() );

Ah, yes true. The sizeof is more a copy paste error from the code I
actually want to use where I need the size of a struct. For this
simplified example I merely replaced the struct with something more
basic, in this case a string.


More information about the zeromq-dev mailing list