[zeromq-dev] message get modified after transmission

Pieter Hintjens ph at imatix.com
Tue Mar 25 10:51:32 CET 2014


In any case CZMQ does not send the null terminator; strings are always
sent as length+content.

If you can make a reproducible case where the last character is lost,
that would help.

On Tue, Mar 25, 2014 at 7:57 AM, Jerry.Wang <wj at everymatrix.com> wrote:
> Hi
>
> I am using CZMQ + ZMQ to connects N linux machines with N Windows machines
> with ROUTER + ROUTER socket.
> It is kind of free-lancer pattern.
>
> It shows to me that the ZMQ is unstable when sending some c-style string
> whose size is about 10-200 KB.
> The following situation happens sometimes.
>
> First, I use zmsg_addstr to add the string and then to send
> char * string_to_be_sent = "...xxxxxend";
> zmsg_addstr( &msg, string_to_be_sent)
>
> And on the other side, I use zmsg_popstr to receive the data.
> Sometimes, the last character in the string is missing. like "...xxxxxen"
>
> Then I change to another manner, to send the c-string with a
> null-terminator.
> char * string_to_be_sent = "...xxxxxend";
> zmsg_addmem( &msg, string_to_be_sent, strlen(string_to_be_sent) + 1);
>
> And on the other side, still use zmsg_popstr to receive the data.
> It works but still sometimes, the returned string is appended with a random
> character (usually an unprintable one).
>
> I added log and my application has no bug.
> And I use the smartsniff to catch the transmission when it happens.
> I see that even the null-terminator is written in the message, ZMQ does not
> send it in raw-TCP package.
> And seems when the client receives the message with zmsg_popstr, a random
> character appears in the position which is supposed for the null-terminator.
>
> I was using ZMQ 4.0.3 + CZMQ 2.0.3
>
> I tried to change to ZMQ 3.2.4 or CZMQ 2.1.0, the problem is still there.
>
> This problem only happens rarely. does anyone know anything about it?
>
> Br
>
>
>
> --
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list