Hello,
I am getting the following error.
Exception in setting up a receiver: capnp/message.c++:99: failed: expected setment != nullptr && segment->checkObject(segment->getStartPtr(), ONE * WORDS); Message did not contain a root pointer.
Here is how I send a byte array.
auto msg_builder = builder.initRoot<SomeMsg>();
msg_builder.setVal(val);
auto words = messageToFlatArray(msg_builder);
auto bytes = words.asBytes();
peer.send(bytes);
And then receive it on the other end.
string msg;
peer.get(msg);
MallocMessageBuilder builder;
const void* arr = msg.c_str();
int len = msg.size();
auto words = kj::heapArray<capnp::word>(len / sizeof(capnp::word));
memcpy(words.begin(), arr, len);
FlatArrayMessageReader reader(words);
// error happens on this call
auto m = reader.getRoot<SomeMsg>();
Any thoughts/hints at what's wrong? Thanks