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:

  1. use capnp::messagetoflatarray() message single flat array. note requires making copy of message contents.
  2. 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 using capnp/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

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -