asio C++ library

PrevUpHomeNext

basic_seq_packet_socket::async_read_some

Async read some data from the peer.

template<
    typename Protocol1,
    typename IOControlCommand>
std::size_t async_read_some(
    basic_seq_packet_socket< Protocol1,
        SocketService, Socket> & peer,
    first protocol,
    asio::error_code & ec,
    * buffers,
    std::size_t max_bytes_to_read);
  * async_read_some(
    basic_seq_packet_socket< Protocol1,
        SocketService, Socket > & peer,
    first protocol,
    asio::error_code & ec,
    * buffers,
    std::size_t max_bytes_to_read);
  * async_read_some(
    basic_seq_packet_socket< Protocol1,
        SocketService, Socket > & peer,
    first protocol,
    asio::error_code & ec,
    * buffers,
    std::size_t max_bytes_to_read);

The async_read_some function is used to asynchronously read a certain number of bytes of data from a stream socket. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

This operation is implemented in terms of zero or more calls to the stream's async_read_some function. When the asio::error::eof error code is returned, this function completes immediately, indicating the end of the stream. Otherwise, the asio::error::eof error code and the bytes transferred are provided.

This function is used internally as the completion function for the basic_stream_socket class of asynchronous operations.

Member Functions

Name

Description

async_read_some

Start an asynchronous operation to read a certain amount of data from the stream socket.

This function is used to asynchronously read data from the stream socket. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  1. The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  2. An error occurred.

async_read_some

Start an asynchronous operation to read a certain amount of data from the stream socket.

This function is used to asynchronously read data from the stream socket. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  1. The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.

async_read_some

Start an asynchronous operation to read a certain amount of data from the stream socket.

This function is used to asynchronously read data from the stream socket. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  1. The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
Member Functions

Name

Description

async_write_some

Start an asynchronous operation to write some data to the peer.

This function is used to asynchronously write some data to the peer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  1. An error occurred.

async_write_some

Start an asynchronous operation to write some data to the peer.

This function is used to asynchronously write some data to the peer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:

  1. An error occurred.

The asio::asio_service class is used to initialize and terminate an application.

It manages the event loop, and is used to register services with the application. The class manages a single event loop, which handles all the event-driven tasks within the application. A basic_io_service is derived from this class.

The asio::asio_service class:

  • Derives from the io_service class.

  • Handles the event loop.

  • Contains the service points.

  • Handles the lifetime.

Member Functions
Member Functions

Name

Description

asio::io_service< > < asio::error_code > asio::io_service<>.create( asio::io_service<>< asio::error_code >

Construct an empty service and add the basic_seq_packet_socket

asio::error<>< asio::error_code