[zeromq-dev] null-terminated strings
Davis Ford
davis at daisyworks.com
Wed Sep 19 20:51:21 CEST 2012
Hi, I'm just getting started out using 0mq - going through the
tutorials / examples. I built a quick hello world demo server in Java
like the examples:
https://github.com/imatix/zguide/blob/master/examples/Java/hwserver.java
and a client in C (as shown on the 1st section of the guide
http://zguide.zeromq.org/page:all)
The Java server has comments about accomodating C/C++ clients by
removing what it expects as the null terminator on the end of the
received byte payload, but in practice when I run this with 0mq
version 3.2.0 it ends up chopping off the last character of the
payload. If I edit the demo server to not strip the last byte, I get
the full "Hello" string.
So, my question is whether the section about having to deal with null
terminated strings at each node is still applicable or has this issue
been abstracted away in a newer version as specified here:
http://zguide.zeromq.org/page:all#A-Minor-Note-on-Strings
Also, I noticed that the example code in the guides seems to use a
higher-level abstraction of the API for C
https://github.com/zeromq/czmq - what is the advantage of using this
over the standard API -- I'm assuming that it layers on top of the API
to make it more friendly? Is the recommended path for C code to use
czmq?
Thanks in advance,
Davis
More information about the zeromq-dev
mailing list