-
Notifications
You must be signed in to change notification settings - Fork 7
Describe how messages are delimited #13
Comments
I don't get if it means sending two message (one "fixed length" and one the actual message) or parsing one message up to the "length" field and then parse the remaining part. |
I don't think the protocol buffer binary format has a way of sending fixed-length messages, so we'd probably want to do something out-of-band, like a 64-bit integer before each message.
I'm not sure what we could use as a delimiter... as far as I know, any byte sequence could show up in a binary-encoded protocol buffer. |
Well, multipart/form-data uses the same idea and is considered solid, so I guess a sufficiently long/randomized string won't really be a problem. Besides the whole stack we're building this for stands atop of a long pile of "good enough randomness", lol. |
Protocol buffers are not self-delimiting, so if we want to communicate over a stream that's not inherently packet-based (which we do, since we plan to use stdin/stdout), we'll need a scheme for indicating which bytes belong to which message. The "Techniques" page of the protobuf documentation suggests writing the message length before the message, which seems like as good a solution as any.
The text was updated successfully, but these errors were encountered: