In normal connections, asuming a socket:
boost::asio::ip::tcp::socket socket_;
it's possible ask the socket status with:
if (socket_.is_open()) { ... }
But instead, in secure connections, asuming a soc开发者_开发知识库ket:
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> socket_;
There is not an is_open()
method for the socket_
object, so the question:
Is there a similar way to know the socket status?
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> socket_;
if ( socket_.lowest_layer().is_open() ) {
// do something great
}
see the documentation for more information.
精彩评论