| Home | Libraries | People | FAQ | More

##### posix::basic_stream_descriptor::io_control (2 of 2 overloads)

Inherited from posix::basic_descriptor.

Perform an IO control command on the descriptor.

    template<
        typename IoControlCommand>
    boost::system::error_code io_control(
        IoControlCommand & command,
        boost::system::error_code & ec);

This function is used to execute an IO control command on the descriptor.

###### Parameters

command

  The IO control command to be performed on the descriptor.

ec

  Set to indicate what error occurred, if any.

###### Example

Getting the number of bytes ready to read:

    boost::asio::posix::stream_descriptor descriptor(io_service);
    ...
    boost::asio::posix::stream_descriptor::bytes_readable command;
    boost::system::error_code ec;
    descriptor.io_control(command, ec);
    if (ec)
    {
      // An error occurred.
    }
    std::size_t bytes_readable = command.get();