Adib Rastegarnia
Adib Rastegarnia

Reputation: 574

protobuf fixed size data for a network packet

I want to encode a network packet into a protobuf message (bytes) but I would like to get a message that its size is exactly the same as original packet in the receiver side. It looks like protobuf optimizes the size of message. Is that possible?

To make it more clear, how can I make sure what I store in bytes will be remained exactly the same as what I see in the original packet.

Upvotes: 1

Views: 600

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062780

That is not the intended scenario of protobuf, and it won't help you do that. There maybe another tool suited for this purpose, but in my experience it is more typical to write packet-focused layers by hand.

Upvotes: 1

Related Questions