[zeromq-dev] message get modified after transmission

Jerry.Wang wj at everymatrix.com
Tue Mar 25 07:57:22 CET 2014


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 
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 

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?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140325/fc01c802/attachment.htm>

More information about the zeromq-dev mailing list