[zeromq-dev] ZMQ appends weird characters to message

gonzalo diethelm gdiethelm at dcv.cl
Mon Sep 15 17:30:13 CEST 2014


No, this is not a (known) limitation. Did you print exactly what you are sending and what you are receiving? My guess is you are putting a null byte in the middle of what you are sending.

-- 
Gonzalo Diethelm
DCV Chile

> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-
> bounces at lists.zeromq.org] On Behalf Of Dávid Kaya
> Sent: Monday, September 15, 2014 12:21 PM
> To: zeromq-dev at lists.zeromq.org
> Subject: Re: [zeromq-dev] ZMQ appends weird characters to message
> 
> Well, I've printed out size and it is correct. I've also shortened the message
> by 5 characters and it stopped cutting off the last characters (atleast I think it
> stopped, tried 15 times and it came correct every time). So I think the
> problem was in the length of the message. I don't know if it is a bug in ZMQ
> or system limitation of socket files?
> 
> David
> 
> 
> On 15.09.2014 16:47, gonzalo diethelm wrote:
> > Good point. Forgot about the specific details for that C++
> > constructor. The null byte should not be required.
> >
> > As Tom points out, you should print out what you are sending and
> > receiving (contents and length) and make sure it makes sense.
> >
> > HTH.
> >
> > --
> > Gonzalo Diethelm
> > DCV Chile
> >
> >> -----Original Message-----
> >> From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-
> >> bounces at lists.zeromq.org] On Behalf Of Tom Quarendon
> >> Sent: Monday, September 15, 2014 11:42 AM
> >> To: ZeroMQ development list
> >> Subject: Re: [zeromq-dev] ZMQ appends weird characters to message
> >>
> >> > 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?
> >>
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> > -----------------------------------------
> > Declaración de confidencialidad: Este Mensaje esta destinado para el
> > uso de la o las personas o entidades a quien ha sido dirigido y puede
> > contener información reservada y confidencial que no puede ser
> > divulgada, difundida, ni aprovechada en forma alguna. El uso no
> > autorizado de la información contenida en este correo podrá ser
> > sancionado de conformidad con la ley chilena.
> > Si usted ha recibido este correo electrónico por error, le pedimos
> > eliminarlo junto con los archivos adjuntos y avisar inmediatamente al
> > remitente, respondiendo este mensaje.
> >
> > "Before printing this e-mail think if is really necesary".
> > Disclosure: This Message is to be used by the individual, individuals
> > or entities that it is addressed to and may include private and
> > confidential information that may not be disclosed, made public nor
> > used in any way at all. Unauthorized use of the information in this
> > electronic mail message may be subject to the penalties set forth by
> > Chilean law.
> > If you have received this electronic mail message in error, we ask you
> > to destroy the message and its attached file(s) and to immediately
> > notify the sender by answering this message.
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

----------------------------------------- 
Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 


More information about the zeromq-dev mailing list