Hi everyone,
being rather new to capnp/kj, I'm currently trying to figure out some good/best practices. Unfortunately it seems to be quite difficult to find some elaborate tutorials and use-case code examples other than those on
https://capnproto.org/ and the git repo itself. I'd very much appreciate if anyone could provide some good general references.
Apart from a general interest, I also have a very specific issue that I need to resolve: The software I need to implement (c++) is supposed to receive multiple (unpacked) capnp message streams over network sockets and process their (deserialized) contents.
I started with a single threaded version receiving data on a single socket in blocking mode using a kj::FdInputStream that I passed on to a MessageReader. So far, this worked quite well.
The next step was to set the socket to non-blocking mode and that is where I got stuck. The MessageReader, I guess, expects (at least) the entire next message to be available but I don't know how to decide if enough bytes have been read from the socket. Obviously I need some clever buffering mechanism in between --- only I can't figure out how.
I'd really appreciate any help on this. Some code examples would be more than welcome :)
Thank you very much in advance!