explicit basic_socket(const executor_type& ex) |
创建&未打开的socket |
template <typename ExecutionContext> explicit basic_socket(ExecutionContext& context, typename enable_if< is_convertible<ExecutionContext&, execution_context&>::value >::type* = 0) |
创建&未打开的socket |
basic_socket(const executor_type& ex, const protocol_type& protocol) | 创建&打开socket |
template <typename ExecutionContext> basic_socket(ExecutionContext& context, const protocol_type& protocol, typename enable_if< is_convertible<ExecutionContext&, execution_context&>::value >::type* = 0) |
创建&打开socket |
basic_socket(const executor_type& ex, const endpoint_type& endpoint) | 创建&打开&绑定local endpoint的socket |
template <typename ExecutionContext> basic_socket(ExecutionContext& context, const endpoint_type& endpoint, typename enable_if< is_convertible<ExecutionContext&, execution_context&>::value >::type* = 0) |
创建&打开&绑定local endpoint的socket |
basic_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket) |
对已经创建的原生套接字创建socket |
template <typename ExecutionContext> basic_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, typename enable_if< is_convertible<ExecutionContext&, execution_context&>::value >::type* = 0) |
对已经创建的原生套接字创建socket |
basic_socket(basic_socket&& other) | 从一个socket移动构造到另一个socket |
basic_socket& operator=(basic_socket&& other) | 从一个socket移动构造到另一个socket |
template <typename Protocol1, typename Executor1> basic_socket(basic_socket<Protocol1, Executor1>&& other, typename enable_if< is_convertible<Protocol1, Protocol>::value && is_convertible<Executor1, Executor>::value >::type* = 0) |
从一个socket移动构造到另一个socket |
template <typename Protocol1, typename Executor1> typename enable_if< is_convertible<Protocol1, Protocol>::value && is_convertible<Executor1, Executor>::value, basic_socket& >::type operator=(basic_socket<Protocol1, Executor1> && other) |
从一个socket移动构造到另一个socket |
executor_type get_executor() | 获取执行器 |
lowest_layer_type& lowest_layer() | 获取basic_socket对象的引用 |
void open(const protocol_type& protocol = protocol_type()) | 打开指定协议的socket |
BOOST_ASIO_SYNC_OP_VOID open(const protocol_type& protocol, boost::system::error_code& ec) |
打开指定协议的socket&返回错误信息 |
void assign(const protocol_type& protocol, 和 BOOST_ASIO_SYNC_OP_VOID assign(const protocol_type& protocol, |
创建&打开socket控制原生socket |
bool is_open() | 判断socket是否打开 |
void close() 和 BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) |
关闭socket |
native_handle_type release() 和 native_handle_type release(boost::system::error_code& ec) |
释放对原生socket的控制 |
native_handle_type native_handle() | 获取原生socket |
void cancel() 和 BOOST_ASIO_SYNC_OP_VOID cancel(boost::system::error_code& ec) |
取消异步操作 |
bool at_mark() 和 bool at_mark(boost::system::error_code& ec) |
确定套接字是否位于out-of-band 数据标记 |
std::size_t available() 和 std::size_t available(boost::system::error_code& ec) |
获取socket可读数据量 |
void bind(const endpoint_type& endpoint) 和 BOOST_ASIO_SYNC_OP_VOID bind(const endpoint_type& endpoint, |
绑定socket道local endpoint |
void connect(const endpoint_type& peer_endpoint) 和 BOOST_ASIO_SYNC_OP_VOID connect(const endpoint_type& peer_endpoint, |
同步阻塞式socket连接到指定的peer_endpoint |
async_connect(const endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) |
异步非阻塞socket连接到指定的peer_endpoint |
template <typename SettableSocketOption> 和 template <typename SettableSocketOption> |
* boost::asio::socket_base::broadcast @n * boost::asio::socket_base::do_not_route @n * boost::asio::socket_base::keep_alive @n * boost::asio::socket_base::linger @n * boost::asio::socket_base::receive_buffer_size @n * boost::asio::socket_base::receive_low_watermark @n * boost::asio::socket_base::reuse_address @n * boost::asio::socket_base::send_buffer_size @n * boost::asio::socket_base::send_low_watermark @n * boost::asio::ip::multicast::join_group @n * boost::asio::ip::multicast::leave_group @n * boost::asio::ip::multicast::enable_loopback @n * boost::asio::ip::multicast::outbound_interface @n * boost::asio::ip::multicast::hops @n * boost::asio::ip::tcp::no_delay |
template <typename GettableSocketOption> 和 template <typename GettableSocketOption> |
同上 |
template <typename IoControlCommand> 和 template <typename IoControlCommand> |
执行IO Commond |
bool non_blocking() BOOST_ASIO_SYNC_OP_VOID non_blocking( 和 void non_blocking(bool mode) |
(1) mode = true时,对于不能马上执行同步操作时,将导致失败boost::asio::error::would_block (2) mode = false时,同步操作将阻塞直到完成 |
bool native_non_blocking() BOOST_ASIO_SYNC_OP_VOID native_non_blocking( 和 void native_non_blocking(bool mode)
|
同上,但是对应原生套接字 |
endpoint_type local_endpoint() 和 endpoint_type local_endpoint(boost::system::error_code& ec) |
获取本地end_point |
endpoint_type remote_endpoint() 和 endpoint_type remote_endpoint(boost::system::error_code& ec) |
获取对端的end_point |
void shutdown(shutdown_type what) 和 BOOST_ASIO_SYNC_OP_VOID shutdown(shutdown_type what, |
关闭socket |
void wait(wait_type w) 和 BOOST_ASIO_SYNC_OP_VOID wait(wait_type w, boost::system::error_code& ec) |
阻塞式等待socket进入wait_type指定的的就绪状态(读就绪,写就绪,错误就绪) |
template <typename WaitHandler> BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, void (boost::system::error_code)) async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) |
异步等待socket进入wait_type指定的就绪状态(读就绪,写就绪,错误就绪) |