开发者

How to know the status of a SSL socket in Boost asio

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜