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指定的就緒狀態(讀就緒,寫就緒,錯誤就緒) |