I found in the internet information and examples on the serialization and deserialization of ready-made classes into a binary. How to do the opposite?

For example, packets with data come to the server that need to be parsed byte by hand. I understand that using protobuf, you can generate classes for this binary and deserialize it. Tell me how this is done on a simple example, please.

  • how to restore proto file from a binary? - KoVadim
  • @KoVadim, apparently yes. I did not see examples with proto files, serialization seems to work without them. - anweledig
  • one
    Without a proto file, serialization / deserialization will work. They are needed only to generate all the necessary classes. But you cannot restore the proto file from the binary. Key names are not saved there. And if some optional field was not added, then also not to know about it. - KoVadim

0