I'm trying to transmit Cereal's serialization result (binary archive) via a TCP link. For the receiving side the first thing is to decide how many bytes (at least) are needed to recover the message object, but seems there is no way to get this information.
The serialization result of a struct with all members of primitive types seems to be as big as the result of sizeof the struct. Is there any guarantee on this? I'm having the concern because if serialized by the portable binary archive, the result is 1 byte bigger. I know this is to record the endianness, but how can the receiving side know this? The only safe method I came up with is to serialize the message and get the size from the output stream. For receiving side this looks not so graceful.