Serialize C++ object to send via sockets to Python - best approach?

后端 未结 2 1412
有刺的猬
有刺的猬 2021-02-04 19:56

I need to create a network communication between two different frameworks, one written in C++ and the other in Python.

To exchange data, I want

相关标签:
2条回答
  • 2021-02-04 20:31

    Go for Protocol Buffers - Google Code which has enough resource for c++ and python. You can make a compatible structure which is readable in both languages.

    Protocol Buffers are a method of serializing structured data. As such, they are useful in developing programs to communicate with each other over a wire or for storing data. The method involves an interface description language that describes the structure of some data and a program that generates from that description source code in various programming languages for generating or parsing a stream of bytes that represents the structured data. †

    0 讨论(0)
  • 2021-02-04 20:41

    Protocol Buffers' successor, Cap'n Proto, also has good support for C++ and Python. (Disclosure: I am the author of Cap'n Proto, and also was the author of most of the Protobuf code released by Google.)

    0 讨论(0)
提交回复
热议问题