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

后端 未结 3 1179
天命终不由人
天命终不由人 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:57

    Confirming everyone here with two links:

    1. https://github.com/boostorg/asio/blob/36eef63a9cf8ae609716d76ccb3906ff9769d53a/include/boost/asio/basic_stream_socket.hpp#L558
    2. https://github.com/boostorg/asio/blob/36eef63a9cf8ae609716d76ccb3906ff9769d53a/include/boost/asio/basic_stream_socket.hpp#L834

    The code is exactly the same. However async_receive has one overload with message_flags, which notably allows you to specify asio::socket_base::message_peek.

提交回复
热议问题