2 // posix/descriptor_base.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP
12 #define BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \
21 || defined(GENERATING_DOCUMENTATION)
23 #include <boost/asio/detail/io_control.hpp>
24 #include <boost/asio/detail/socket_option.hpp>
26 #include <boost/asio/detail/push_options.hpp>
32 /// The descriptor_base class is used as a base for the descriptor class as a
33 /// place to define the associated IO control commands.
39 * For use with descriptor::wait() and descriptor::async_wait().
43 /// Wait for a descriptor to become ready to read.
46 /// Wait for a descriptor to become ready to write.
49 /// Wait for a descriptor to have error conditions pending.
53 /// IO control command to get the amount of data that can be read without
56 * Implements the FIONREAD IO control command.
60 * boost::asio::posix::stream_descriptor descriptor(io_context);
62 * boost::asio::descriptor_base::bytes_readable command(true);
63 * descriptor.io_control(command);
64 * std::size_t bytes_readable = command.get();
70 #if defined(GENERATING_DOCUMENTATION)
71 typedef implementation_defined bytes_readable;
73 typedef boost::asio::detail::io_control::bytes_readable bytes_readable;
77 /// Protected destructor to prevent deletion through this type.
87 #include <boost/asio/detail/pop_options.hpp>
89 #endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
90 // || defined(GENERATING_DOCUMENTATION)
92 #endif // BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP