[zeromq-dev] Ruby binding s.recv returns 0-terminated string

Mikko Koppanen mikko.koppanen at gmail.com
Sun Mar 6 12:21:36 CET 2011

On Sat, Mar 5, 2011 at 8:49 PM, Han Holl <han.holl at pobox.com> wrote:
> Hi,
> The function
> s.recv
> returns a string like "OK\000", at least with my ruby-
> Maybe there are ruby implementations that make the trailing zero go away.


as the message data is an opaque binary blob I am not sure whether
removing the trailing \0 is correct behaviour. If you are receiving a
message with a trailing \0 it means that the sender has included it as
a part of the message. It is perfectly OK to send non-null terminated
blobs as well and removing the last character would possibly break

Mikko Koppanen

More information about the zeromq-dev mailing list