snippets.ipp 751 B

123456789101112131415161718192021222324252627
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. // This header file is designed to be included multiple times
  10. // inside of function bodies holding documentation snippets.
  11. using namespace boost::beast;
  12. namespace net = boost::asio;
  13. namespace ssl = boost::asio::ssl;
  14. using tcp = net::ip::tcp;
  15. error_code ec;
  16. net::io_context ioc;
  17. auto work = net::make_work_guard(ioc);
  18. std::thread t{[&](){ ioc.run(); }};
  19. tcp::socket sock(ioc);
  20. ssl::context ctx(ssl::context::tlsv12);
  21. boost::ignore_unused(ec);