need to call ssl::stream::shutdown when closing boost asio ssl socket?

和自甴很熟 提交于 2019-12-04 11:28:20

It is cleanest to make shutdown() calls on both the ssl::stream and its lowest_layer(). The first ends the SSL connection and the second ends the TCP connection. If you're getting an error on the SSL shutdown, it may be that the other side is not being as graceful in ending the connection.

Just call close(). It isn't legal to shutdown SSL sockets: there is no such thing as a half-close in SSL. See RFC 2246, discussion of close_notify.

I do highly recommend that you should not use shutdown method and don't respect SSL layer + TCP layer (lowest_layer). be in safe side and close the tcp lowest_layer as

m_remote_socket.lowest_layer().close(ec);

The problem i faced that the time you respect the SSL or TCP, the application resources(socket handler) will stock in memory till server side send close session ack.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!