使用谷物序列化和boost :: asio的示例

使用谷物序列化和boost :: asio的示例

问题描述:

我正在尝试序列化对象/消息,并将其作为UDP数据包在节点之间发送.我目前正在寻找谷物进行序列化,将boost :: asio用于实际的网络编程.有没有使用这两个库的示例,即使它们是伪代码?

I'm trying to serialize objects/messages and send them as UDP packets between nodes. I'm currently looking at cereal for serialization and boost::asio for actual network programming. Are there any examples of using these two libraries together, even if it's pseudocode?

您可以将任何使用Asio的Boost序列化示例视为伪代码示例.尽管存在一些差异,但Cereal足够类似于Boost序列化以使样本相关.

You can treat any example of Boost Serialization with Asio as the pseudo code example. Despite some differences, Cereal is similar enough to Boost Serialization for the samples to be relevant.

  • Straight forward: sending/receiving a struct in boost::asio
  • Backgrounds: Low bandwidth performance using boost::asio::ip::tcp::iostream
  • More choices, raw POD data: c++ Sending struct over network