ZeroMQ + Protocol Buffers

前端 未结 4 809

ZeroMQ FAQ page suggest use of Google\'s protobuf as a way to serialise message content.

Has anyone see a good usage example?

I also need to get the answer to \"

4条回答
  •  悲哀的现实
    2021-01-31 17:23

    You always need to serialize when communicating. Structures are random access. Communication layers, like ZeroMQ are serial.

    You can use the "default serialization" that comes with your language.

    For example in C++ a structure with no pointers will have a certain binary layout that can be directly turned into a byte array. This binary layout is, indirectly, your serialization layer, and is both language and compiler specific.

    As long as you limit yourself to structures that have no pointers and are using the same compiler and language on both ends of the pipe... feel free to avoid a library that does additional serialization on top of the default layout provided.

提交回复
热议问题