Boost.Asio socket destructor closes connection?

后端 未结 3 535
南笙
南笙 2021-01-11 17:37

What exactly does the destructor of boost::asio::ip::tcp::socket do? I can\'t tell, even after scouring Boost docs and source code, if I need to use

         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-11 18:03

    No you don't need to close it. Though it might be cleaner to do so, if you want to report any errors surrounding protocol shutdown.

    The destructor just /appears/ to be empty, that's a good sign of Modern C++:

    • http://en.cppreference.com/w/cpp/language/rule_of_three
    • Rule Of Zero

提交回复
热议问题