How to read a fix-sized packet using boost asio?

前端 未结 3 426
醉梦人生
醉梦人生 2021-01-06 17:44

I am doing a synchronous read/write using boost-asio. The data is coming in binary format, without boundary, the length information is encoded in the packet

3条回答
  •  抹茶落季
    2021-01-06 18:12

    Simple:

    boost::asio::read(socket, buffers, boost::asio::transfer_exactly(your_fixed_size));
    

提交回复
热议问题