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

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

python - Pygame screen.blit not working -

c# - Web API response xml language -