Hi,

I would like to receive capnp messages over zeromq without extra copying 
the data from zeromq into capnp messages.

My current approach is based on these articles/tutorials/posts:

   - ZeroMQ - Multipart + ZeroCopy: http://zeromq.org/blog:zero-copy
   - Old post about sending and receiving via ZeroMQ + Capnp: 
   https://groups.google.com/d/msg/capnproto/ClDjGbO7egA/JZjlsUr5kCkJ
   - Question about ownership of CAPNP messages, while sending via ZeroMQ: 
   https://lists.zeromq.org/pipermail/zeromq-dev/2017-March/031525.html

So the sending part (untested & uncompiled) is currently like this:
    
    auto segments = message.getSegmentsForOutput();

    auto it = segments.begin();
    auto i = segments.size();
    assert(i != 0);
    while (--i != 0)
    {
        zmq_send_const(this->socket, reinterpret_cast<char const 
*>(&(*it)[0]), it->size() * sizeof(capnp::word),
                       ZMQ_SNDMORE);
        ++it;
    }
    zmq_send_const(this->socket, reinterpret_cast<char const *>(&(*it)[0]), 
it->size() * sizeof(capnp::word), 0);


The question is how should I create a capnp message from the received parts 
of a zeromq multipart message? I read about word alignment, which is taken 
care of in the second of the above links. But it looks like a lot of 
copies, could they be avoided?


General hints/advices are welcome too. :)


Greetings,

  Stephan

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to