asio C++ library

PrevUpHomeNext
basic_stream_socket::wait (2 of 2 overloads)

Inherited from basic_socket.

Wait for the socket to become ready to read, ready to write, or to have pending error conditions.

void wait(
    wait_type w,
    asio::error_code & ec);

This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.

Parameters

w

Specifies the desired socket state.

ec

Set to indicate what error occurred, if any.

Example

Waiting for a socket to become readable.

asio::ip::tcp::socket socket(my_context);
...
asio::error_code ec;
socket.wait(asio::ip::tcp::socket::wait_read, ec);

PrevUpHomeNext