Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Cap'n Proto Support Delimited Messages

Does Cap'n Proto support delimited messages?

My goal is to write multiple messages to a file pipe and read in real-time as they are being written.

So...

  1. The messages need to be delimited in some way.

  2. And the parser must be able to detect incomplete messages and wait.

like image 580
BAR Avatar asked Dec 06 '25 17:12

BAR


1 Answers

Yes. Unlike Protocol Buffers, Cap'n Proto messages are inherently self-delimiting. If you use the standard serialization functions to repeatedly write messages to the same stream, or repeatedly read messages from the same stream, it will "just work". Make sure to use the serialization / parsing routines that write to / read from a stream (in C++ you can use a file descriptor or an abstract InputStream/OutputStream), so that the parser knows how to wait for input. There are also asynchronous (non-blocking) versions of these if you prefer an event-driven approach.

like image 151
Kenton Varda Avatar answered Dec 08 '25 06:12

Kenton Varda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!