boost::asio 序列16: tcp::socket 和 udp::socket & socket_basic

安稳与你 提交于 2020-04-12 16:56:51

           reactive_socket_service_base          execution_context_service_base <reative_socket_service<Porotocol>>  

                                                                \                         |

                                                                reactive_socket_service<Protocol>

                                                                                    |                                                                          

                                  socket_basic             io_object_impl<Protocol, Executor>  (成员变量)               system_executor            

                                                              \                   |                                                                                      |

                                                                   basic_socket<Protocol, Executor>    其中 Exector =====>     executor 

                                                                         /                         \                                                                       

                          basic_stream_socket<tcp>                 basic_datagram_socket<udp>                        

socket_basic:定义socket共用的一些数据类型和选项

shutdown_type     shutdown_receive = BOOST_ASIO_OS_DEF(SHUT_RD),
    shutdown_send = BOOST_ASIO_OS_DEF(SHUT_WR),
    shutdown_both = BOOST_ASIO_OS_DEF(SHUT_RDWR)

message_flags   BOOST_ASIO_STATIC_CONSTANT(int,
      message_peek = BOOST_ASIO_OS_DEF(MSG_PEEK));
  BOOST_ASIO_STATIC_CONSTANT(int,
      message_out_of_band = BOOST_ASIO_OS_DEF(MSG_OOB));
  BOOST_ASIO_STATIC_CONSTANT(int,
      message_do_not_route = BOOST_ASIO_OS_DEF(MSG_DONTROUTE));
  BOOST_ASIO_STATIC_CONSTANT(int,
      message_end_of_record = BOOST_ASIO_OS_DEF(MSG_EOR));






wait_type

  enum wait_type
  {
    /// Wait for a socket to become ready to read.
    wait_read,


    /// Wait for a socket to become ready to write.
    wait_write,

    /// Wait for a socket to have error conditions pending.
    wait_error
  };

SOL_SOCKET/SO_BROADCAST   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_BROADCAST)>
      broadcast;

SOL_SOCKET/SO_DEBUG   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DEBUG)> debug;
SOL_SOCKET/SO_DONTROUTE   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_DONTROUTE)>
      do_not_route;

SOL_SOCKET/SO_KEEPALIVE   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive;
SOL_SOCKET/SO_SNDBUF   typedef boost::asio::detail::socket_option::integer<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDBUF)>
      send_buffer_size;

SOL_SOCKET/SO_SNDLOWAT   typedef boost::asio::detail::socket_option::integer<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_SNDLOWAT)>
      send_low_watermark;

SOL_SOCKET/SO_RCVBUF   typedef boost::asio::detail::socket_option::integer<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVBUF)>
      receive_buffer_size;

SOL_SOCKET/SO_RCVLOWAT   typedef boost::asio::detail::socket_option::integer<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_RCVLOWAT)>
      receive_low_watermark;

SOL_SOCKET/SO_REUSEADDR   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_REUSEADDR)>
      reuse_address;

 SOL_SOCKET/SO_LINGER   typedef boost::asio::detail::socket_option::linger<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_LINGER)>
      linger;

SOL_SOCKET/SO_OOBINLINE   typedef boost::asio::detail::socket_option::boolean<
    BOOST_ASIO_OS_DEF(SOL_SOCKET), BOOST_ASIO_OS_DEF(SO_OOBINLINE)>
      out_of_band_inline;

Socket option to report aborted connections on accept   typedef boost::asio::detail::socket_option::boolean<
    boost::asio::detail::custom_socket_option_level,
    boost::asio::detail::enable_connection_aborted_option>
    enable_connection_aborted;


the FIONREAD IO control command typedef boost::asio::detail::io_control::bytes_readable bytes_readable;

       

发布了203 篇原创文章 · 获赞 109 · 访问量 32万+
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!