What is the difference between asio::tcp::socket's async_read_some and async_receive?

后端 未结 3 1191
天命终不由人
天命终不由人 2020-12-30 20:23

What is the difference between:

  • boost::asio::tcp::socket::async_read_some()
  • boost::asio::tcp::socket::async_receive()
  • <
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 20:48

    I believe the two are essentially identical. The reason they provide both is to provide interfaces similar to both iostreams (which have a read_some member) and sockets (which have a receive).

    As Peter Tseng pointed out, async_receive does also have an overload that accepts socket_base::message_flags, which async_read_some does not.

提交回复
热议问题