boost::asio::basic_stream_socket::async_receive

Start an asynchronous receive.

Synopses

Declared in <boost/asio/basic_stream_socket.hpp>

Start an asynchronous receive.

template<
    typename MutableBufferSequence,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<executor_type>>
decltype(async_initiate<ReadToken,
        void (boost::system::error_code, std::size_t)>(
          declval<initiate_async_receive>(), token,
          buffers, socket_base::message_flags(0)))
async_receive(
    MutableBufferSequence const& buffers,
    ReadToken&& token = default_completion_token_t<executor_type>());

Start an asynchronous receive.

template<
    typename MutableBufferSequence,
    boost::asio::completion_token_for<void(boost::system::error_code, size_t)> ReadToken = default_completion_token_t<executor_type>>
decltype(async_initiate<ReadToken,
        void (boost::system::error_code, std::size_t)>(
          declval<initiate_async_receive>(), token, buffers, flags))
async_receive(
    MutableBufferSequence const& buffers,
    socket_base::message_flags flags,
    ReadToken&& token = default_completion_token_t<executor_type>());

Parameters

Name

Description

buffers

One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the completion handler is called.

token

The completion_token that will be used to produce a completion handler, which will be called when the receive completes. Potential completion tokens include use_future, use_awaitable, yield_context, or a function object with the correct completion signature. The function signature of the completion handler must be:

flags

Flags specifying how the receive call is to be made.

Created with MrDocs