0

I have to serialize some data and after send it using socket AF_UNIX. I have read (here) that I can't create a struct and just send it using a cast (void *). So, I would like to know which is the best method to handle this problem. Thank you!

1 Answers1

1

You basically have two options:

  1. Roll your own exactly as in the question you referenced.
  2. Use an off-the-shelf serialization/deserialization system. If you go this route, Google's Protocol Buffers are pretty much industry standard. For constrained projects (embedded, etc.) nanopb is a good choice for the implementation.
Jon Reeves
  • 2,426
  • 3
  • 14