[zeromq-dev] ZMQ appends weird characters to message

gonzalo diethelm gdiethelm at dcv.cl
Mon Sep 15 16:23:52 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.

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 Dávid Kaya
> Sent: Monday, September 15, 2014 3:55 AM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] ZMQ appends weird characters to message
> 
> string response =
> string(static_cast<char*>(reply.data()),reply.size());
> 
> That is how I convert it to string. After that I use the url in webkit and the
> "login" message is only used in application.
> 
> On 15.09.2014 01:05, Thomas Rodgers wrote:
> > How do you display the string on the receiving end?
> >
> > On Sunday, September 14, 2014, Dávid Kaya  wrote:
> >
> >> Hi,
> >>
> >> Let's say I have a message like this one:
> >>
> >> string loginMessage = "login";
> >> zmq::message_t
> >> request((void*)loginMessage.c_str(),loginMessage.length(),NULL);
> >>
> >> whenever I send it, it comes like this: "loginY Socket-Type".
> >> There is
> >> also a empty "box" after Y. Then when I send a url, (120 characters
> >> approx.), zmq cuts off last couple of characters and replace them
> >> with '@' followed by empty boxes. It's always same characters, it
> >> does not change. It's a 'Y' with empty box in "login" message and '@'
> >> with empty boxes in url message.
> >>
> >> I use IPC socket (REP/REQ) on linux (created in "/tmp/*socket*"), zmq
> >> version 4.0.4 and c++ binding (last version).
> >>
> >> Thanks,
> >>
> >> David
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev [1]
> >
> >
> > Links:
> > ------
> > [1] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > [2] mailto:mail at davidkaya.sk
> _______________________________________________
> 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