继承自 basic_socket。
禁用套接字上的发送或接收。
void shutdown( shutdown_type what, boost::system::error_code & ec);
此函数用于禁用发送操作、接收操作或两者都禁用。
确定哪些类型的操作将不再允许。
用于指示发生何种错误(如果有)。
关闭套接字的发送端
boost::asio::ip::tcp::socket socket(my_context); ... boost::system::error_code ec; socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); if (ec) { // An error occurred. }