无论如何基本上做以下事情:
#include <boost/asio.hpp>
struct testStruct{
int x;
int y;
};
int main(){
struct testStruct t;
boost::asio::buffer b;
b = boost::asio::buffer(t);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
似乎失败的地方是将't'传递到缓冲区'b'.
我正在做一个需要通过网络发送和接收数据的程序.我从未处理过对象序列化.我对有关Boost和Google Protocol Buffers的一些建议感到厌烦.在Linux中使用哪个最好?
如果您了解其他一些我将非常感谢您的帮助.
谢谢.