c++ - How to Send Cap'n Proto Message over ZMQ -
the example way send messages using cap'n proto needs file descriptor write to:
::capnp::writemessagetofd(fd, message);
but in zmq message needs passed zmq function:
zmq_send(requester, "hello", 5, 0);
http://zguide.zeromq.org/page:all
how can incompatibility resolved?
two possibilities:
- use
capnp::messagetoflatarray()
message single flat array. note requires making copy of message contents. - send message zeromq multi-part message, parts being message's segments.
capnp::messagebuilder::getsegmentsforoutput()
returns array of arrays pointing raw message segments.capnp::segmentarraymessagereader
takes such array of arrays input. if can send array of arrays multipart message, can skip usingcapnp/serialize.h
@ all, since purpose combine segments single message segment table. in case, zeromq in charge of remembering each segment starts , ends.
i recommend #2, more complicated.
Comments
Post a Comment