Eli Bendersky: Length-prefix framing for protocol buffers | prg | Scoop.it

I personally find Google’s protocol buffers library (protobuf) extremely convenient for efficient serialization and de-serialization of structured data from multiple programming languages. protobufs are perfect for TCP/IP links in general and socket-based IPC in particular.

Framing (the method of dividing a long stream of bytes into discrete messages) isn’t immediately obvious with protobuf. What you get from a protobuf serialization is a binary buffer of data. You almost certainly want to send more than one such buffer over time, so how does your peer know when one message ends and another starts?


Via Mathieu D.