[zeromq-dev] ZMQ appends weird characters to message
Tom Quarendon
tom.quarendon at teamwpc.co.uk
Mon Sep 15 16:41:32 CEST 2014
> You have two choices:
> 1. Send the '\0' as part of the message (and set length to one more byte).
> 2. Append a '\0' after receiving the message.
Uh, why?
string(static_cast<char*>(reply.data()),reply.size());
doesn't assume the string is null terminated. It constructs string from pointer and length. Isn't adding a in a null just going mask the real issue and make it look like the std::string only contained "login" when really it still contained the extra stuff as well.
David, Do you know what reply.size() actually contains? Have you tried printing that out and comparing it to what you expect?
More information about the zeromq-dev
mailing list