diff options
Diffstat (limited to 'doc/html/boost_asio/example')
167 files changed, 1202 insertions, 580 deletions
diff --git a/doc/html/boost_asio/example/cpp03/allocation/server.cpp b/doc/html/boost_asio/example/cpp03/allocation/server.cpp index cb4cbcd472..4c4bbf5b0f 100644 --- a/doc/html/boost_asio/example/cpp03/allocation/server.cpp +++ b/doc/html/boost_asio/example/cpp03/allocation/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/buffers/reference_counted.cpp b/doc/html/boost_asio/example/cpp03/buffers/reference_counted.cpp index 81128f5986..f62b6bc16c 100644 --- a/doc/html/boost_asio/example/cpp03/buffers/reference_counted.cpp +++ b/doc/html/boost_asio/example/cpp03/buffers/reference_counted.cpp @@ -2,7 +2,7 @@ // reference_counted.cpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/chat/chat_client.cpp b/doc/html/boost_asio/example/cpp03/chat/chat_client.cpp index e37dfe4b57..9c60e92a5c 100644 --- a/doc/html/boost_asio/example/cpp03/chat/chat_client.cpp +++ b/doc/html/boost_asio/example/cpp03/chat/chat_client.cpp @@ -2,7 +2,7 @@ // chat_client.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/chat/chat_message.hpp b/doc/html/boost_asio/example/cpp03/chat/chat_message.hpp index 75d31ab993..942b480a19 100644 --- a/doc/html/boost_asio/example/cpp03/chat/chat_message.hpp +++ b/doc/html/boost_asio/example/cpp03/chat/chat_message.hpp @@ -2,7 +2,7 @@ // chat_message.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/chat/chat_server.cpp b/doc/html/boost_asio/example/cpp03/chat/chat_server.cpp index 903b568bce..e5d79019e1 100644 --- a/doc/html/boost_asio/example/cpp03/chat/chat_server.cpp +++ b/doc/html/boost_asio/example/cpp03/chat/chat_server.cpp @@ -2,7 +2,7 @@ // chat_server.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp b/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp index 40844c94e4..994be59bd9 100644 --- a/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp +++ b/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp @@ -2,7 +2,7 @@ // posix_chat_client.cpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp b/doc/html/boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp index f0a672dde6..9afc46541b 100644 --- a/doc/html/boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp @@ -2,7 +2,7 @@ // async_tcp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/async_udp_echo_server.cpp b/doc/html/boost_asio/example/cpp03/echo/async_udp_echo_server.cpp index bdcd4f785b..5723d28011 100644 --- a/doc/html/boost_asio/example/cpp03/echo/async_udp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/async_udp_echo_server.cpp @@ -2,7 +2,7 @@ // async_udp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp b/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp index 1def9d0bc0..74b28106bb 100644 --- a/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp @@ -2,7 +2,7 @@ // blocking_tcp_echo_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp b/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp index c4acbe4e15..28846129fc 100644 --- a/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp @@ -2,7 +2,7 @@ // blocking_tcp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp b/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp index 3b1067a03e..71d503a3da 100644 --- a/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp @@ -2,7 +2,7 @@ // blocking_udp_echo_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp b/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp index 5e70a6e44f..00dc177698 100644 --- a/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp @@ -2,7 +2,7 @@ // blocking_udp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/fork/daemon.cpp b/doc/html/boost_asio/example/cpp03/fork/daemon.cpp index 53fdf28781..db69befbae 100644 --- a/doc/html/boost_asio/example/cpp03/fork/daemon.cpp +++ b/doc/html/boost_asio/example/cpp03/fork/daemon.cpp @@ -2,7 +2,7 @@ // daemon.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/fork/process_per_connection.cpp b/doc/html/boost_asio/example/cpp03/fork/process_per_connection.cpp index 305cdc2d23..f85ea93dca 100644 --- a/doc/html/boost_asio/example/cpp03/fork/process_per_connection.cpp +++ b/doc/html/boost_asio/example/cpp03/fork/process_per_connection.cpp @@ -2,7 +2,7 @@ // process_per_connection.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/client/async_client.cpp b/doc/html/boost_asio/example/cpp03/http/client/async_client.cpp index 61832aa34f..5c486e39c0 100644 --- a/doc/html/boost_asio/example/cpp03/http/client/async_client.cpp +++ b/doc/html/boost_asio/example/cpp03/http/client/async_client.cpp @@ -2,7 +2,7 @@ // async_client.cpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/client/sync_client.cpp b/doc/html/boost_asio/example/cpp03/http/client/sync_client.cpp index 6813e053f5..d2af7c593e 100644 --- a/doc/html/boost_asio/example/cpp03/http/client/sync_client.cpp +++ b/doc/html/boost_asio/example/cpp03/http/client/sync_client.cpp @@ -2,7 +2,7 @@ // sync_client.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/connection.cpp b/doc/html/boost_asio/example/cpp03/http/server/connection.cpp index c922257697..8e4a960cd5 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/connection.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/connection.cpp @@ -2,7 +2,7 @@ // connection.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/connection.hpp b/doc/html/boost_asio/example/cpp03/http/server/connection.hpp index 80bf20df5e..9f806549eb 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/connection.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/connection.hpp @@ -2,7 +2,7 @@ // connection.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/connection_manager.cpp b/doc/html/boost_asio/example/cpp03/http/server/connection_manager.cpp index ac2ba36817..b7eb24e211 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/connection_manager.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/connection_manager.cpp @@ -2,7 +2,7 @@ // connection_manager.cpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/connection_manager.hpp b/doc/html/boost_asio/example/cpp03/http/server/connection_manager.hpp index 706c4e1e07..1e18e4490e 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/connection_manager.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/connection_manager.hpp @@ -2,7 +2,7 @@ // connection_manager.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/header.hpp b/doc/html/boost_asio/example/cpp03/http/server/header.hpp index 877211f190..18bad986a4 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/header.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/header.hpp @@ -2,7 +2,7 @@ // header.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/main.cpp b/doc/html/boost_asio/example/cpp03/http/server/main.cpp index 0125aee76a..9ea3c09a96 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/main.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/main.cpp @@ -2,7 +2,7 @@ // main.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/mime_types.cpp b/doc/html/boost_asio/example/cpp03/http/server/mime_types.cpp index a03d5e7a16..8a66683e01 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/mime_types.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/mime_types.cpp @@ -2,7 +2,7 @@ // mime_types.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/mime_types.hpp b/doc/html/boost_asio/example/cpp03/http/server/mime_types.hpp index 891c443669..a5f352e69a 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/mime_types.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/mime_types.hpp @@ -2,7 +2,7 @@ // mime_types.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/reply.cpp b/doc/html/boost_asio/example/cpp03/http/server/reply.cpp index 4f08fe34d3..d9a4df0d7e 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/reply.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/reply.cpp @@ -2,7 +2,7 @@ // reply.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/reply.hpp b/doc/html/boost_asio/example/cpp03/http/server/reply.hpp index 51d495bc65..03293227e7 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/reply.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/reply.hpp @@ -2,7 +2,7 @@ // reply.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/request.hpp b/doc/html/boost_asio/example/cpp03/http/server/request.hpp index 20efff4dd3..6488b1ddeb 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/request.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/request.hpp @@ -2,7 +2,7 @@ // request.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/request_handler.cpp b/doc/html/boost_asio/example/cpp03/http/server/request_handler.cpp index 1b45ce577c..a8a5a5529c 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/request_handler.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/request_handler.cpp @@ -2,7 +2,7 @@ // request_handler.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/request_handler.hpp b/doc/html/boost_asio/example/cpp03/http/server/request_handler.hpp index 542df83b7a..7d05dbcb91 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/request_handler.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/request_handler.hpp @@ -2,7 +2,7 @@ // request_handler.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/request_parser.cpp b/doc/html/boost_asio/example/cpp03/http/server/request_parser.cpp index bda4f1dbe3..7ce45ddeab 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/request_parser.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/request_parser.cpp @@ -2,7 +2,7 @@ // request_parser.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/request_parser.hpp b/doc/html/boost_asio/example/cpp03/http/server/request_parser.hpp index f8c45bec9f..ecda685f57 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/request_parser.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/request_parser.hpp @@ -2,7 +2,7 @@ // request_parser.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/server.cpp b/doc/html/boost_asio/example/cpp03/http/server/server.cpp index 1ebddad8d2..912a4369d4 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/server.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server/server.hpp b/doc/html/boost_asio/example/cpp03/http/server/server.hpp index 8702dce85b..e14d3527a4 100644 --- a/doc/html/boost_asio/example/cpp03/http/server/server.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server/server.hpp @@ -2,7 +2,7 @@ // server.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/connection.cpp b/doc/html/boost_asio/example/cpp03/http/server2/connection.cpp index 328e4a9fff..d671ba5bec 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/connection.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/connection.cpp @@ -2,7 +2,7 @@ // connection.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/connection.hpp b/doc/html/boost_asio/example/cpp03/http/server2/connection.hpp index b9ba677f56..770a0aaa6b 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/connection.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/connection.hpp @@ -2,7 +2,7 @@ // connection.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/header.hpp b/doc/html/boost_asio/example/cpp03/http/server2/header.hpp index 45613d3cf4..559c5c1aef 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/header.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/header.hpp @@ -2,7 +2,7 @@ // header.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.cpp b/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.cpp index ed47b75569..817517a7e4 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.cpp @@ -2,7 +2,7 @@ // io_context_pool.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.hpp b/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.hpp index 7af524a077..06bd88658a 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/io_context_pool.hpp @@ -2,7 +2,7 @@ // io_context_pool.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/main.cpp b/doc/html/boost_asio/example/cpp03/http/server2/main.cpp index c6a00836c2..2d04db4cb7 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/main.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/main.cpp @@ -2,7 +2,7 @@ // main.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/mime_types.cpp b/doc/html/boost_asio/example/cpp03/http/server2/mime_types.cpp index 5dee5eb3b6..0fdd731015 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/mime_types.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/mime_types.cpp @@ -2,7 +2,7 @@ // mime_types.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/mime_types.hpp b/doc/html/boost_asio/example/cpp03/http/server2/mime_types.hpp index bf1f6d39e5..c11280b5d0 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/mime_types.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/mime_types.hpp @@ -2,7 +2,7 @@ // mime_types.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/reply.cpp b/doc/html/boost_asio/example/cpp03/http/server2/reply.cpp index d7f7c987cb..5da5414621 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/reply.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/reply.cpp @@ -2,7 +2,7 @@ // reply.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/reply.hpp b/doc/html/boost_asio/example/cpp03/http/server2/reply.hpp index fd386217ef..8a974bbc44 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/reply.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/reply.hpp @@ -2,7 +2,7 @@ // reply.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/request.hpp b/doc/html/boost_asio/example/cpp03/http/server2/request.hpp index 0d70416209..3eb3494f3e 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/request.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/request.hpp @@ -2,7 +2,7 @@ // request.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/request_handler.cpp b/doc/html/boost_asio/example/cpp03/http/server2/request_handler.cpp index 84f50b8732..acac4d1830 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/request_handler.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/request_handler.cpp @@ -2,7 +2,7 @@ // request_handler.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/request_handler.hpp b/doc/html/boost_asio/example/cpp03/http/server2/request_handler.hpp index 75d8d0d0ba..3f9c743304 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/request_handler.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/request_handler.hpp @@ -2,7 +2,7 @@ // request_handler.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/request_parser.cpp b/doc/html/boost_asio/example/cpp03/http/server2/request_parser.cpp index 8e2e4637e6..b7e7d6490c 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/request_parser.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/request_parser.cpp @@ -2,7 +2,7 @@ // request_parser.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/request_parser.hpp b/doc/html/boost_asio/example/cpp03/http/server2/request_parser.hpp index a8c6945492..a986720951 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/request_parser.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/request_parser.hpp @@ -2,7 +2,7 @@ // request_parser.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/server.cpp b/doc/html/boost_asio/example/cpp03/http/server2/server.cpp index d3bfa58ea7..367708c59d 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/server.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server2/server.hpp b/doc/html/boost_asio/example/cpp03/http/server2/server.hpp index a35415b5e0..3867a9204d 100644 --- a/doc/html/boost_asio/example/cpp03/http/server2/server.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server2/server.hpp @@ -2,7 +2,7 @@ // server.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp b/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp index 37890b570d..378ded16b2 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/connection.cpp @@ -2,7 +2,7 @@ // connection.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/connection.hpp b/doc/html/boost_asio/example/cpp03/http/server3/connection.hpp index 420dd0e743..5cb78db242 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/connection.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/connection.hpp @@ -2,7 +2,7 @@ // connection.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/header.hpp b/doc/html/boost_asio/example/cpp03/http/server3/header.hpp index 54e034ba29..d53fede4b0 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/header.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/header.hpp @@ -2,7 +2,7 @@ // header.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/main.cpp b/doc/html/boost_asio/example/cpp03/http/server3/main.cpp index ee1812e425..c7af0c7a1c 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/main.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/main.cpp @@ -2,7 +2,7 @@ // main.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/mime_types.cpp b/doc/html/boost_asio/example/cpp03/http/server3/mime_types.cpp index 97aba9db57..8bc6cd47eb 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/mime_types.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/mime_types.cpp @@ -2,7 +2,7 @@ // mime_types.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/mime_types.hpp b/doc/html/boost_asio/example/cpp03/http/server3/mime_types.hpp index e4793e0613..559380699f 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/mime_types.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/mime_types.hpp @@ -2,7 +2,7 @@ // mime_types.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/reply.cpp b/doc/html/boost_asio/example/cpp03/http/server3/reply.cpp index a8a2f3e7b9..e899c68424 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/reply.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/reply.cpp @@ -2,7 +2,7 @@ // reply.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/reply.hpp b/doc/html/boost_asio/example/cpp03/http/server3/reply.hpp index fa3c7e8f7f..7931e70a69 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/reply.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/reply.hpp @@ -2,7 +2,7 @@ // reply.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/request.hpp b/doc/html/boost_asio/example/cpp03/http/server3/request.hpp index 388f80b6f9..92ef781771 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/request.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/request.hpp @@ -2,7 +2,7 @@ // request.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/request_handler.cpp b/doc/html/boost_asio/example/cpp03/http/server3/request_handler.cpp index 611d06c311..e13d21d884 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/request_handler.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/request_handler.cpp @@ -2,7 +2,7 @@ // request_handler.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/request_handler.hpp b/doc/html/boost_asio/example/cpp03/http/server3/request_handler.hpp index 167b3771d5..8697fbcd9e 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/request_handler.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/request_handler.hpp @@ -2,7 +2,7 @@ // request_handler.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/request_parser.cpp b/doc/html/boost_asio/example/cpp03/http/server3/request_parser.cpp index 9ef5e7c773..1623443829 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/request_parser.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/request_parser.cpp @@ -2,7 +2,7 @@ // request_parser.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/request_parser.hpp b/doc/html/boost_asio/example/cpp03/http/server3/request_parser.hpp index 20da2d55e7..19cfa1c9f8 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/request_parser.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/request_parser.hpp @@ -2,7 +2,7 @@ // request_parser.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/server.cpp b/doc/html/boost_asio/example/cpp03/http/server3/server.cpp index fc1c651686..edcc3a89fd 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/server.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server3/server.hpp b/doc/html/boost_asio/example/cpp03/http/server3/server.hpp index 8f1b1c20af..ede47b232a 100644 --- a/doc/html/boost_asio/example/cpp03/http/server3/server.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server3/server.hpp @@ -2,7 +2,7 @@ // server.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/file_handler.cpp b/doc/html/boost_asio/example/cpp03/http/server4/file_handler.cpp index d1cdb0e2f0..1a4bb6c8ab 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/file_handler.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/file_handler.cpp @@ -2,7 +2,7 @@ // file_handler.cpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/file_handler.hpp b/doc/html/boost_asio/example/cpp03/http/server4/file_handler.hpp index 678da526e8..1835922bfc 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/file_handler.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/file_handler.hpp @@ -2,7 +2,7 @@ // file_handler.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/header.hpp b/doc/html/boost_asio/example/cpp03/http/server4/header.hpp index 4478e1de39..8fa25127b7 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/header.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/header.hpp @@ -2,7 +2,7 @@ // header.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/main.cpp b/doc/html/boost_asio/example/cpp03/http/server4/main.cpp index 449ffa3a3e..cdcd484388 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/main.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/main.cpp @@ -2,7 +2,7 @@ // main.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/mime_types.cpp b/doc/html/boost_asio/example/cpp03/http/server4/mime_types.cpp index 255f628e89..7b30ffbf4e 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/mime_types.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/mime_types.cpp @@ -2,7 +2,7 @@ // mime_types.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/mime_types.hpp b/doc/html/boost_asio/example/cpp03/http/server4/mime_types.hpp index 7f3f04f9ce..6eae007d36 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/mime_types.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/mime_types.hpp @@ -2,7 +2,7 @@ // mime_types.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/reply.cpp b/doc/html/boost_asio/example/cpp03/http/server4/reply.cpp index b69247c2e6..5d21aa18d0 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/reply.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/reply.cpp @@ -2,7 +2,7 @@ // reply.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/reply.hpp b/doc/html/boost_asio/example/cpp03/http/server4/reply.hpp index 1f744a7a17..fae8bfea41 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/reply.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/reply.hpp @@ -2,7 +2,7 @@ // reply.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/request.hpp b/doc/html/boost_asio/example/cpp03/http/server4/request.hpp index ade91fa965..902212ad56 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/request.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/request.hpp @@ -2,7 +2,7 @@ // request.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/request_parser.cpp b/doc/html/boost_asio/example/cpp03/http/server4/request_parser.cpp index 1031e7046c..0e1a598379 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/request_parser.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/request_parser.cpp @@ -2,7 +2,7 @@ // request_parser.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/request_parser.hpp b/doc/html/boost_asio/example/cpp03/http/server4/request_parser.hpp index 34d4c47f58..42edfd36da 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/request_parser.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/request_parser.hpp @@ -2,7 +2,7 @@ // request_parser.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/server.cpp b/doc/html/boost_asio/example/cpp03/http/server4/server.cpp index 080fa345b9..9a8d39e1ea 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/server.cpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/http/server4/server.hpp b/doc/html/boost_asio/example/cpp03/http/server4/server.hpp index 3ef3b68a9b..ed5a392a00 100644 --- a/doc/html/boost_asio/example/cpp03/http/server4/server.hpp +++ b/doc/html/boost_asio/example/cpp03/http/server4/server.hpp @@ -2,7 +2,7 @@ // server.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/icmp/icmp_header.hpp b/doc/html/boost_asio/example/cpp03/icmp/icmp_header.hpp index 12272e21a8..2e6f46b019 100644 --- a/doc/html/boost_asio/example/cpp03/icmp/icmp_header.hpp +++ b/doc/html/boost_asio/example/cpp03/icmp/icmp_header.hpp @@ -2,7 +2,7 @@ // icmp_header.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/icmp/ipv4_header.hpp b/doc/html/boost_asio/example/cpp03/icmp/ipv4_header.hpp index b724707d50..1026aa2762 100644 --- a/doc/html/boost_asio/example/cpp03/icmp/ipv4_header.hpp +++ b/doc/html/boost_asio/example/cpp03/icmp/ipv4_header.hpp @@ -2,7 +2,7 @@ // ipv4_header.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/icmp/ping.cpp b/doc/html/boost_asio/example/cpp03/icmp/ping.cpp index 4daf81948b..b4aac7cbf0 100644 --- a/doc/html/boost_asio/example/cpp03/icmp/ping.cpp +++ b/doc/html/boost_asio/example/cpp03/icmp/ping.cpp @@ -2,7 +2,7 @@ // ping.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -18,8 +18,8 @@ #include "ipv4_header.hpp" using boost::asio::ip::icmp; -using boost::asio::deadline_timer; -namespace posix_time = boost::posix_time; +using boost::asio::steady_timer; +namespace chrono = boost::asio::chrono; class pinger { @@ -53,12 +53,12 @@ private: os << echo_request << body; // Send the request. - time_sent_ = posix_time::microsec_clock::universal_time(); + time_sent_ = steady_timer::clock_type::now(); socket_.send_to(request_buffer.data(), destination_); // Wait up to five seconds for a reply. num_replies_ = 0; - timer_.expires_at(time_sent_ + posix_time::seconds(5)); + timer_.expires_at(time_sent_ + chrono::seconds(5)); timer_.async_wait(boost::bind(&pinger::handle_timeout, this)); } @@ -68,7 +68,7 @@ private: std::cout << "Request timed out" << std::endl; // Requests must be sent no less than one second apart. - timer_.expires_at(time_sent_ + posix_time::seconds(1)); + timer_.expires_at(time_sent_ + chrono::seconds(1)); timer_.async_wait(boost::bind(&pinger::start_send, this)); } @@ -106,12 +106,14 @@ private: timer_.cancel(); // Print out some information about the reply packet. - posix_time::ptime now = posix_time::microsec_clock::universal_time(); + chrono::steady_clock::time_point now = chrono::steady_clock::now(); + chrono::steady_clock::duration elapsed = now - time_sent_; std::cout << length - ipv4_hdr.header_length() << " bytes from " << ipv4_hdr.source_address() << ": icmp_seq=" << icmp_hdr.sequence_number() << ", ttl=" << ipv4_hdr.time_to_live() - << ", time=" << (now - time_sent_).total_milliseconds() << " ms" + << ", time=" + << chrono::duration_cast<chrono::milliseconds>(elapsed).count() << std::endl; } @@ -130,9 +132,9 @@ private: icmp::resolver resolver_; icmp::endpoint destination_; icmp::socket socket_; - deadline_timer timer_; + steady_timer timer_; unsigned short sequence_number_; - posix_time::ptime time_sent_; + chrono::steady_clock::time_point time_sent_; boost::asio::streambuf reply_buffer_; std::size_t num_replies_; }; diff --git a/doc/html/boost_asio/example/cpp03/invocation/prioritised_handlers.cpp b/doc/html/boost_asio/example/cpp03/invocation/prioritised_handlers.cpp index 5e2dcb7997..71940977ba 100644 --- a/doc/html/boost_asio/example/cpp03/invocation/prioritised_handlers.cpp +++ b/doc/html/boost_asio/example/cpp03/invocation/prioritised_handlers.cpp @@ -2,7 +2,7 @@ // prioritised_handlers.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -153,8 +153,8 @@ int main() client_socket.connect(acceptor.local_endpoint()); // Set a deadline timer to expire immediately. - boost::asio::deadline_timer timer(io_context); - timer.expires_at(boost::posix_time::neg_infin); + boost::asio::steady_timer timer(io_context); + timer.expires_at(boost::asio::steady_timer::time_point::min()); timer.async_wait(pri_queue.wrap(42, middle_priority_handler)); while (io_context.run_one()) diff --git a/doc/html/boost_asio/example/cpp03/iostreams/daytime_client.cpp b/doc/html/boost_asio/example/cpp03/iostreams/daytime_client.cpp index 20ed37211f..c750024ddd 100644 --- a/doc/html/boost_asio/example/cpp03/iostreams/daytime_client.cpp +++ b/doc/html/boost_asio/example/cpp03/iostreams/daytime_client.cpp @@ -2,7 +2,7 @@ // daytime_client.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/iostreams/daytime_server.cpp b/doc/html/boost_asio/example/cpp03/iostreams/daytime_server.cpp index 3e0356c79b..b7aae994c0 100644 --- a/doc/html/boost_asio/example/cpp03/iostreams/daytime_server.cpp +++ b/doc/html/boost_asio/example/cpp03/iostreams/daytime_server.cpp @@ -2,7 +2,7 @@ // daytime_server.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/iostreams/http_client.cpp b/doc/html/boost_asio/example/cpp03/iostreams/http_client.cpp index 52842abfd7..2460123297 100644 --- a/doc/html/boost_asio/example/cpp03/iostreams/http_client.cpp +++ b/doc/html/boost_asio/example/cpp03/iostreams/http_client.cpp @@ -2,7 +2,7 @@ // http_client.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -33,7 +33,7 @@ int main(int argc, char* argv[]) // The entire sequence of I/O operations must complete within 60 seconds. // If an expiry occurs, the socket is automatically closed and the stream // becomes bad. - s.expires_after(boost::posix_time::seconds(60)); + s.expires_after(boost::asio::chrono::seconds(60)); // Establish a connection to the server. s.connect(argv[1], "http"); diff --git a/doc/html/boost_asio/example/cpp03/local/connect_pair.cpp b/doc/html/boost_asio/example/cpp03/local/connect_pair.cpp index 934731b710..892ec62f06 100644 --- a/doc/html/boost_asio/example/cpp03/local/connect_pair.cpp +++ b/doc/html/boost_asio/example/cpp03/local/connect_pair.cpp @@ -2,7 +2,7 @@ // connect_pair.cpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/local/iostream_client.cpp b/doc/html/boost_asio/example/cpp03/local/iostream_client.cpp index d2e0621c82..9ddc80c3c6 100644 --- a/doc/html/boost_asio/example/cpp03/local/iostream_client.cpp +++ b/doc/html/boost_asio/example/cpp03/local/iostream_client.cpp @@ -2,7 +2,7 @@ // stream_client.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/local/stream_client.cpp b/doc/html/boost_asio/example/cpp03/local/stream_client.cpp index 915cbe2f3f..a41e937ad8 100644 --- a/doc/html/boost_asio/example/cpp03/local/stream_client.cpp +++ b/doc/html/boost_asio/example/cpp03/local/stream_client.cpp @@ -2,7 +2,7 @@ // stream_client.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/local/stream_server.cpp b/doc/html/boost_asio/example/cpp03/local/stream_server.cpp index 05194240c3..8eea66a525 100644 --- a/doc/html/boost_asio/example/cpp03/local/stream_server.cpp +++ b/doc/html/boost_asio/example/cpp03/local/stream_server.cpp @@ -2,7 +2,7 @@ // stream_server.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/multicast/receiver.cpp b/doc/html/boost_asio/example/cpp03/multicast/receiver.cpp index ed9d5ccb27..fcea3c9169 100644 --- a/doc/html/boost_asio/example/cpp03/multicast/receiver.cpp +++ b/doc/html/boost_asio/example/cpp03/multicast/receiver.cpp @@ -2,7 +2,7 @@ // receiver.cpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/multicast/sender.cpp b/doc/html/boost_asio/example/cpp03/multicast/sender.cpp index 15267248b4..aa27dade75 100644 --- a/doc/html/boost_asio/example/cpp03/multicast/sender.cpp +++ b/doc/html/boost_asio/example/cpp03/multicast/sender.cpp @@ -2,7 +2,7 @@ // sender.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -13,7 +13,6 @@ #include <string> #include <boost/asio.hpp> #include "boost/bind.hpp" -#include "boost/date_time/posix_time/posix_time_types.hpp" const short multicast_port = 30001; const int max_message_count = 10; @@ -42,7 +41,7 @@ public: { if (!error && message_count_ < max_message_count) { - timer_.expires_from_now(boost::posix_time::seconds(1)); + timer_.expires_after(boost::asio::chrono::seconds(1)); timer_.async_wait( boost::bind(&sender::handle_timeout, this, boost::asio::placeholders::error)); @@ -67,7 +66,7 @@ public: private: boost::asio::ip::udp::endpoint endpoint_; boost::asio::ip::udp::socket socket_; - boost::asio::deadline_timer timer_; + boost::asio::steady_timer timer_; int message_count_; std::string message_; }; diff --git a/doc/html/boost_asio/example/cpp03/nonblocking/third_party_lib.cpp b/doc/html/boost_asio/example/cpp03/nonblocking/third_party_lib.cpp index 6ace6d8c63..1148947615 100644 --- a/doc/html/boost_asio/example/cpp03/nonblocking/third_party_lib.cpp +++ b/doc/html/boost_asio/example/cpp03/nonblocking/third_party_lib.cpp @@ -2,7 +2,7 @@ // third_party_lib.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/porthopper/client.cpp b/doc/html/boost_asio/example/cpp03/porthopper/client.cpp index 05c020cd75..dc02322ebf 100644 --- a/doc/html/boost_asio/example/cpp03/porthopper/client.cpp +++ b/doc/html/boost_asio/example/cpp03/porthopper/client.cpp @@ -2,7 +2,7 @@ // client.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/porthopper/protocol.hpp b/doc/html/boost_asio/example/cpp03/porthopper/protocol.hpp index 272aa876eb..f67de4f748 100644 --- a/doc/html/boost_asio/example/cpp03/porthopper/protocol.hpp +++ b/doc/html/boost_asio/example/cpp03/porthopper/protocol.hpp @@ -2,7 +2,7 @@ // protocol.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/porthopper/server.cpp b/doc/html/boost_asio/example/cpp03/porthopper/server.cpp index 0426c365be..e8c9f8af67 100644 --- a/doc/html/boost_asio/example/cpp03/porthopper/server.cpp +++ b/doc/html/boost_asio/example/cpp03/porthopper/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -22,7 +22,7 @@ using boost::asio::ip::tcp; using boost::asio::ip::udp; typedef boost::shared_ptr<tcp::socket> tcp_socket_ptr; -typedef boost::shared_ptr<boost::asio::deadline_timer> timer_ptr; +typedef boost::shared_ptr<boost::asio::steady_timer> timer_ptr; typedef boost::shared_ptr<control_request> control_request_ptr; class server @@ -43,7 +43,7 @@ public: boost::asio::placeholders::error, new_socket)); // Start the timer used to generate outgoing frames. - timer_.expires_from_now(boost::posix_time::milliseconds(100)); + timer_.expires_after(boost::asio::chrono::milliseconds(100)); timer_.async_wait(boost::bind(&server::handle_timer, this)); } @@ -75,8 +75,8 @@ public: { // Delay handling of the control request to simulate network latency. timer_ptr delay_timer( - new boost::asio::deadline_timer(acceptor_.get_executor().context())); - delay_timer->expires_from_now(boost::posix_time::seconds(2)); + new boost::asio::steady_timer(acceptor_.get_executor().context())); + delay_timer->expires_after(boost::asio::chrono::seconds(2)); delay_timer->async_wait( boost::bind(&server::handle_control_request_timer, this, socket, request, delay_timer)); @@ -142,7 +142,7 @@ public: } // Wait for next timeout. - timer_.expires_from_now(boost::posix_time::milliseconds(100)); + timer_.expires_after(boost::asio::chrono::milliseconds(100)); timer_.async_wait(boost::bind(&server::handle_timer, this)); } @@ -151,7 +151,7 @@ private: tcp::acceptor acceptor_; // The timer used for generating data. - boost::asio::deadline_timer timer_; + boost::asio::steady_timer timer_; // The socket used to send data to subscribers. udp::socket udp_socket_; diff --git a/doc/html/boost_asio/example/cpp03/serialization/client.cpp b/doc/html/boost_asio/example/cpp03/serialization/client.cpp index 06f3e4c09e..f11e55f44e 100644 --- a/doc/html/boost_asio/example/cpp03/serialization/client.cpp +++ b/doc/html/boost_asio/example/cpp03/serialization/client.cpp @@ -2,7 +2,7 @@ // client.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/serialization/connection.hpp b/doc/html/boost_asio/example/cpp03/serialization/connection.hpp index 88b0a71508..4eb662db90 100644 --- a/doc/html/boost_asio/example/cpp03/serialization/connection.hpp +++ b/doc/html/boost_asio/example/cpp03/serialization/connection.hpp @@ -2,7 +2,7 @@ // connection.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/serialization/server.cpp b/doc/html/boost_asio/example/cpp03/serialization/server.cpp index 6fb4881d94..df99e371ec 100644 --- a/doc/html/boost_asio/example/cpp03/serialization/server.cpp +++ b/doc/html/boost_asio/example/cpp03/serialization/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/serialization/stock.hpp b/doc/html/boost_asio/example/cpp03/serialization/stock.hpp index 67a5d3f49b..b1d1c60c62 100644 --- a/doc/html/boost_asio/example/cpp03/serialization/stock.hpp +++ b/doc/html/boost_asio/example/cpp03/serialization/stock.hpp @@ -2,7 +2,7 @@ // stock.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/services/basic_logger.hpp b/doc/html/boost_asio/example/cpp03/services/basic_logger.hpp index 0f56c2fef8..6f0aeb426f 100644 --- a/doc/html/boost_asio/example/cpp03/services/basic_logger.hpp +++ b/doc/html/boost_asio/example/cpp03/services/basic_logger.hpp @@ -2,7 +2,7 @@ // basic_logger.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/services/daytime_client.cpp b/doc/html/boost_asio/example/cpp03/services/daytime_client.cpp index 204382a989..109e061699 100644 --- a/doc/html/boost_asio/example/cpp03/services/daytime_client.cpp +++ b/doc/html/boost_asio/example/cpp03/services/daytime_client.cpp @@ -2,7 +2,7 @@ // daytime_client.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/services/logger.hpp b/doc/html/boost_asio/example/cpp03/services/logger.hpp index 749620d1ab..71ec68d0b8 100644 --- a/doc/html/boost_asio/example/cpp03/services/logger.hpp +++ b/doc/html/boost_asio/example/cpp03/services/logger.hpp @@ -2,7 +2,7 @@ // logger.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/services/logger_service.cpp b/doc/html/boost_asio/example/cpp03/services/logger_service.cpp index 1324d30745..82fcb223c5 100644 --- a/doc/html/boost_asio/example/cpp03/services/logger_service.cpp +++ b/doc/html/boost_asio/example/cpp03/services/logger_service.cpp @@ -2,7 +2,7 @@ // logger_service.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/services/logger_service.hpp b/doc/html/boost_asio/example/cpp03/services/logger_service.hpp index 071d6bfc5e..84ac5a195c 100644 --- a/doc/html/boost_asio/example/cpp03/services/logger_service.hpp +++ b/doc/html/boost_asio/example/cpp03/services/logger_service.hpp @@ -2,7 +2,7 @@ // logger_service.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/socks4/socks4.hpp b/doc/html/boost_asio/example/cpp03/socks4/socks4.hpp index 07dc1a1ce2..e954d7a88a 100644 --- a/doc/html/boost_asio/example/cpp03/socks4/socks4.hpp +++ b/doc/html/boost_asio/example/cpp03/socks4/socks4.hpp @@ -2,7 +2,7 @@ // socks4.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/socks4/sync_client.cpp b/doc/html/boost_asio/example/cpp03/socks4/sync_client.cpp index e9106a059c..5650248603 100644 --- a/doc/html/boost_asio/example/cpp03/socks4/sync_client.cpp +++ b/doc/html/boost_asio/example/cpp03/socks4/sync_client.cpp @@ -2,7 +2,7 @@ // sync_client.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp b/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp index db6a1679f5..6b60b46f4a 100644 --- a/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp +++ b/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp @@ -2,16 +2,16 @@ // echo_server.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/asio/deadline_timer.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/spawn.hpp> +#include <boost/asio/steady_timer.hpp> #include <boost/asio/write.hpp> #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> @@ -53,7 +53,7 @@ private: char data[128]; for (;;) { - timer_.expires_from_now(boost::posix_time::seconds(10)); + timer_.expires_after(boost::asio::chrono::seconds(10)); std::size_t n = socket_.async_read_some(boost::asio::buffer(data), yield); boost::asio::async_write(socket_, boost::asio::buffer(data, n), yield); } @@ -71,14 +71,14 @@ private: { boost::system::error_code ignored_ec; timer_.async_wait(yield[ignored_ec]); - if (timer_.expires_from_now() <= boost::posix_time::seconds(0)) + if (timer_.expiry() <= boost::asio::steady_timer::clock_type::now()) socket_.close(); } } boost::asio::io_context::strand strand_; tcp::socket socket_; - boost::asio::deadline_timer timer_; + boost::asio::steady_timer timer_; }; void do_accept(boost::asio::io_context& io_context, diff --git a/doc/html/boost_asio/example/cpp03/spawn/parallel_grep.cpp b/doc/html/boost_asio/example/cpp03/spawn/parallel_grep.cpp index 63aa2fc447..5de86204b5 100644 --- a/doc/html/boost_asio/example/cpp03/spawn/parallel_grep.cpp +++ b/doc/html/boost_asio/example/cpp03/spawn/parallel_grep.cpp @@ -2,7 +2,7 @@ // parallel_grep.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/ssl/client.cpp b/doc/html/boost_asio/example/cpp03/ssl/client.cpp index 7239496add..6064ca4959 100644 --- a/doc/html/boost_asio/example/cpp03/ssl/client.cpp +++ b/doc/html/boost_asio/example/cpp03/ssl/client.cpp @@ -2,7 +2,7 @@ // client.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/ssl/server.cpp b/doc/html/boost_asio/example/cpp03/ssl/server.cpp index 604189034e..0848b0a096 100644 --- a/doc/html/boost_asio/example/cpp03/ssl/server.cpp +++ b/doc/html/boost_asio/example/cpp03/ssl/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp03/timeouts/async_tcp_client.cpp b/doc/html/boost_asio/example/cpp03/timeouts/async_tcp_client.cpp index 2134e6395d..f295ed5fb2 100644 --- a/doc/html/boost_asio/example/cpp03/timeouts/async_tcp_client.cpp +++ b/doc/html/boost_asio/example/cpp03/timeouts/async_tcp_client.cpp @@ -2,22 +2,23 @@ // async_tcp_client.cpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/asio/deadline_timer.hpp> +#include <boost/asio/buffer.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/read_until.hpp> -#include <boost/asio/streambuf.hpp> +#include <boost/asio/steady_timer.hpp> #include <boost/asio/write.hpp> #include <boost/bind.hpp> #include <iostream> +#include <string> -using boost::asio::deadline_timer; +using boost::asio::steady_timer; using boost::asio::ip::tcp; // @@ -78,7 +79,7 @@ using boost::asio::ip::tcp; // // The heartbeat actor sends a heartbeat (a message that consists of a single // newline character) every 10 seconds. In this example, no deadline is applied -// message sending. +// to message sending. // class client { @@ -125,7 +126,7 @@ private: std::cout << "Trying " << endpoint_iter->endpoint() << "...\n"; // Set a deadline for the connect operation. - deadline_.expires_from_now(boost::posix_time::seconds(60)); + deadline_.expires_after(boost::asio::chrono::seconds(60)); // Start the asynchronous connect operation. socket_.async_connect(endpoint_iter->endpoint(), @@ -185,14 +186,15 @@ private: void start_read() { // Set a deadline for the read operation. - deadline_.expires_from_now(boost::posix_time::seconds(30)); + deadline_.expires_after(boost::asio::chrono::seconds(30)); // Start an asynchronous operation to read a newline-delimited message. - boost::asio::async_read_until(socket_, input_buffer_, '\n', - boost::bind(&client::handle_read, this, _1)); + boost::asio::async_read_until(socket_, + boost::asio::dynamic_buffer(input_buffer_), '\n', + boost::bind(&client::handle_read, this, _1, _2)); } - void handle_read(const boost::system::error_code& ec) + void handle_read(const boost::system::error_code& ec, std::size_t n) { if (stopped_) return; @@ -200,9 +202,8 @@ private: if (!ec) { // Extract the newline-delimited message from the buffer. - std::string line; - std::istream is(&input_buffer_); - std::getline(is, line); + std::string line(input_buffer_.substr(0, n - 1)); + input_buffer_.erase(0, n); // Empty messages are heartbeats and so ignored. if (!line.empty()) @@ -238,7 +239,7 @@ private: if (!ec) { // Wait 10 seconds before sending the next heartbeat. - heartbeat_timer_.expires_from_now(boost::posix_time::seconds(10)); + heartbeat_timer_.expires_after(boost::asio::chrono::seconds(10)); heartbeat_timer_.async_wait(boost::bind(&client::start_write, this)); } else @@ -257,15 +258,16 @@ private: // Check whether the deadline has passed. We compare the deadline against // the current time since a new asynchronous operation may have moved the // deadline before this actor had a chance to run. - if (deadline_.expires_at() <= deadline_timer::traits_type::now()) + if (deadline_.expiry() <= steady_timer::clock_type::now()) { // The deadline has passed. The socket is closed so that any outstanding // asynchronous operations are cancelled. socket_.close(); - // There is no longer an active deadline. The expiry is set to positive - // infinity so that the actor takes no action until a new deadline is set. - deadline_.expires_at(boost::posix_time::pos_infin); + // There is no longer an active deadline. The expiry is set to the + // maximum time point so that the actor takes no action until a new + // deadline is set. + deadline_.expires_at(steady_timer::time_point::max()); } // Put the actor back to sleep. @@ -276,9 +278,9 @@ private: bool stopped_; tcp::resolver::results_type endpoints_; tcp::socket socket_; - boost::asio::streambuf input_buffer_; - deadline_timer deadline_; - deadline_timer heartbeat_timer_; + std::string input_buffer_; + steady_timer deadline_; + steady_timer heartbeat_timer_; }; int main(int argc, char* argv[]) diff --git a/doc/html/boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp b/doc/html/boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp index 67224cfd0f..2392882c87 100644 --- a/doc/html/boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp +++ b/doc/html/boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp @@ -2,18 +2,17 @@ // blocking_tcp_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // +#include <boost/asio/buffer.hpp> #include <boost/asio/connect.hpp> -#include <boost/asio/deadline_timer.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/read_until.hpp> -#include <boost/asio/streambuf.hpp> #include <boost/system/system_error.hpp> #include <boost/asio/write.hpp> #include <cstdlib> @@ -22,178 +21,127 @@ #include <boost/lambda/bind.hpp> #include <boost/lambda/lambda.hpp> -using boost::asio::deadline_timer; using boost::asio::ip::tcp; using boost::lambda::bind; using boost::lambda::var; using boost::lambda::_1; +using boost::lambda::_2; //---------------------------------------------------------------------- // -// This class manages socket timeouts by applying the concept of a deadline. -// Each asynchronous operation is given a deadline by which it must complete. -// Deadlines are enforced by an "actor" that persists for the lifetime of the -// client object: -// -// +----------------+ -// | | -// | check_deadline |<---+ -// | | | -// +----------------+ | async_wait() -// | | -// +---------+ -// -// If the actor determines that the deadline has expired, the socket is closed -// and any outstanding operations are consequently cancelled. The socket -// operations themselves use boost::lambda function objects as completion -// handlers. For a given socket operation, the client object runs the -// io_context to block thread execution until the actor completes. +// This class manages socket timeouts by running the io_context using the timed +// io_context::run_for() member function. Each asynchronous operation is given +// a timeout within which it must complete. The socket operations themselves +// use boost::lambda function objects as completion handlers. For a given +// socket operation, the client object runs the io_context to block thread +// execution until the operation completes or the timeout is reached. If the +// io_context::run_for() function times out, the socket is closed and the +// outstanding asynchronous operation is cancelled. // class client { public: client() - : socket_(io_context_), - deadline_(io_context_) + : socket_(io_context_) { - // No deadline is required until the first socket operation is started. We - // set the deadline to positive infinity so that the actor takes no action - // until a specific deadline is set. - deadline_.expires_at(boost::posix_time::pos_infin); - - // Start the persistent actor that checks for deadline expiry. - check_deadline(); } void connect(const std::string& host, const std::string& service, - boost::posix_time::time_duration timeout) + boost::asio::chrono::steady_clock::duration timeout) { // Resolve the host name and service to a list of endpoints. tcp::resolver::results_type endpoints = tcp::resolver(io_context_).resolve(host, service); - // Set a deadline for the asynchronous operation. As a host name may - // resolve to multiple endpoints, this function uses the composed operation - // async_connect. The deadline applies to the entire operation, rather than - // individual connection attempts. - deadline_.expires_from_now(timeout); - - // Set up the variable that receives the result of the asynchronous - // operation. The error code is set to would_block to signal that the - // operation is incomplete. Asio guarantees that its asynchronous - // operations will never fail with would_block, so any other value in - // ec indicates completion. - boost::system::error_code ec = boost::asio::error::would_block; - // Start the asynchronous operation itself. The boost::lambda function // object is used as a callback and will update the ec variable when the // operation completes. The blocking_udp_client.cpp example shows how you // can use boost::bind rather than boost::lambda. + boost::system::error_code ec; boost::asio::async_connect(socket_, endpoints, var(ec) = _1); - // Block until the asynchronous operation has completed. - do io_context_.run_one(); while (ec == boost::asio::error::would_block); - - // Determine whether a connection was successfully established. The - // deadline actor may have had a chance to run and close our socket, even - // though the connect operation notionally succeeded. Therefore we must - // check whether the socket is still open before deciding if we succeeded - // or failed. - if (ec || !socket_.is_open()) - throw boost::system::system_error( - ec ? ec : boost::asio::error::operation_aborted); + // Run the operation until it completes, or until the timeout. + run(timeout); + + // Determine whether a connection was successfully established. + if (ec) + throw boost::system::system_error(ec); } - std::string read_line(boost::posix_time::time_duration timeout) + std::string read_line(boost::asio::chrono::steady_clock::duration timeout) { - // Set a deadline for the asynchronous operation. Since this function uses - // a composed operation (async_read_until), the deadline applies to the - // entire operation, rather than individual reads from the socket. - deadline_.expires_from_now(timeout); - - // Set up the variable that receives the result of the asynchronous - // operation. The error code is set to would_block to signal that the - // operation is incomplete. Asio guarantees that its asynchronous - // operations will never fail with would_block, so any other value in - // ec indicates completion. - boost::system::error_code ec = boost::asio::error::would_block; - - // Start the asynchronous operation itself. The boost::lambda function - // object is used as a callback and will update the ec variable when the - // operation completes. The blocking_udp_client.cpp example shows how you - // can use boost::bind rather than boost::lambda. - boost::asio::async_read_until(socket_, input_buffer_, '\n', var(ec) = _1); - - // Block until the asynchronous operation has completed. - do io_context_.run_one(); while (ec == boost::asio::error::would_block); - + // Start the asynchronous operation. The boost::lambda function object is + // used as a callback and will update the ec variable when the operation + // completes. The blocking_udp_client.cpp example shows how you can use + // boost::bind rather than boost::lambda. + boost::system::error_code ec; + std::size_t n = 0; + boost::asio::async_read_until(socket_, + boost::asio::dynamic_buffer(input_buffer_), + '\n', (var(ec) = _1, var(n) = _2)); + + // Run the operation until it completes, or until the timeout. + run(timeout); + + // Determine whether the read completed successfully. if (ec) throw boost::system::system_error(ec); - std::string line; - std::istream is(&input_buffer_); - std::getline(is, line); + std::string line(input_buffer_.substr(0, n - 1)); + input_buffer_.erase(0, n); return line; } void write_line(const std::string& line, - boost::posix_time::time_duration timeout) + boost::asio::chrono::steady_clock::duration timeout) { std::string data = line + "\n"; - // Set a deadline for the asynchronous operation. Since this function uses - // a composed operation (async_write), the deadline applies to the entire - // operation, rather than individual writes to the socket. - deadline_.expires_from_now(timeout); - - // Set up the variable that receives the result of the asynchronous - // operation. The error code is set to would_block to signal that the - // operation is incomplete. Asio guarantees that its asynchronous - // operations will never fail with would_block, so any other value in - // ec indicates completion. - boost::system::error_code ec = boost::asio::error::would_block; - - // Start the asynchronous operation itself. The boost::lambda function - // object is used as a callback and will update the ec variable when the - // operation completes. The blocking_udp_client.cpp example shows how you - // can use boost::bind rather than boost::lambda. + // Start the asynchronous operation. The boost::lambda function object is + // used as a callback and will update the ec variable when the operation + // completes. The blocking_udp_client.cpp example shows how you can use + // boost::bind rather than boost::lambda. + boost::system::error_code ec; boost::asio::async_write(socket_, boost::asio::buffer(data), var(ec) = _1); - // Block until the asynchronous operation has completed. - do io_context_.run_one(); while (ec == boost::asio::error::would_block); + // Run the operation until it completes, or until the timeout. + run(timeout); + // Determine whether the read completed successfully. if (ec) throw boost::system::system_error(ec); } private: - void check_deadline() + void run(boost::asio::chrono::steady_clock::duration timeout) { - // Check whether the deadline has passed. We compare the deadline against - // the current time since a new asynchronous operation may have moved the - // deadline before this actor had a chance to run. - if (deadline_.expires_at() <= deadline_timer::traits_type::now()) + // Restart the io_context, as it may have been left in the "stopped" state + // by a previous operation. + io_context_.restart(); + + // Block until the asynchronous operation has completed, or timed out. If + // the pending asynchronous operation is a composed operation, the deadline + // applies to the entire operation, rather than individual operations on + // the socket. + io_context_.run_for(timeout); + + // If the asynchronous operation completed successfully then the io_context + // would have been stopped due to running out of work. If it was not + // stopped, then the io_context::run_for call must have timed out. + if (!io_context_.stopped()) { - // The deadline has passed. The socket is closed so that any outstanding - // asynchronous operations are cancelled. This allows the blocked - // connect(), read_line() or write_line() functions to return. - boost::system::error_code ignored_ec; - socket_.close(ignored_ec); - - // There is no longer an active deadline. The expiry is set to positive - // infinity so that the actor takes no action until a new deadline is set. - deadline_.expires_at(boost::posix_time::pos_infin); - } + // Close the socket to cancel the outstanding asynchronous operation. + socket_.close(); - // Put the actor back to sleep. - deadline_.async_wait(bind(&client::check_deadline, this)); + // Run the io_context again until the operation completes. + io_context_.run(); + } } boost::asio::io_context io_context_; tcp::socket socket_; - deadline_timer deadline_; - boost::asio::streambuf input_buffer_; + std::string input_buffer_; }; //---------------------------------------------------------------------- @@ -204,32 +152,34 @@ int main(int argc, char* argv[]) { if (argc != 4) { - std::cerr << "Usage: blocking_tcp <host> <port> <message>\n"; + std::cerr << "Usage: blocking_tcp_client <host> <port> <message>\n"; return 1; } client c; - c.connect(argv[1], argv[2], boost::posix_time::seconds(10)); + c.connect(argv[1], argv[2], boost::asio::chrono::seconds(10)); - boost::posix_time::ptime time_sent = - boost::posix_time::microsec_clock::universal_time(); + boost::asio::chrono::steady_clock::time_point time_sent = + boost::asio::chrono::steady_clock::now(); - c.write_line(argv[3], boost::posix_time::seconds(10)); + c.write_line(argv[3], boost::asio::chrono::seconds(10)); for (;;) { - std::string line = c.read_line(boost::posix_time::seconds(10)); + std::string line = c.read_line(boost::asio::chrono::seconds(10)); // Keep going until we get back the line that was sent. if (line == argv[3]) break; } - boost::posix_time::ptime time_received = - boost::posix_time::microsec_clock::universal_time(); + boost::asio::chrono::steady_clock::time_point time_received = + boost::asio::chrono::steady_clock::now(); std::cout << "Round trip time: "; - std::cout << (time_received - time_sent).total_microseconds(); + std::cout << boost::asio::chrono::duration_cast< + boost::asio::chrono::microseconds>( + time_received - time_sent).count(); std::cout << " microseconds\n"; } catch (std::exception& e) diff --git a/doc/html/boost_asio/example/cpp03/timeouts/blocking_token_tcp_client.cpp b/doc/html/boost_asio/example/cpp03/timeouts/blocking_token_tcp_client.cpp new file mode 100644 index 0000000000..0903d87864 --- /dev/null +++ b/doc/html/boost_asio/example/cpp03/timeouts/blocking_token_tcp_client.cpp @@ -0,0 +1,198 @@ +// +// blocking_token_tcp_client.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/asio/connect.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/read_until.hpp> +#include <boost/asio/streambuf.hpp> +#include <boost/system/system_error.hpp> +#include <boost/asio/write.hpp> +#include <cstdlib> +#include <iostream> +#include <memory> +#include <string> + +using boost::asio::ip::tcp; + +//---------------------------------------------------------------------- + +// A custom completion token that makes asynchronous operations behave as +// though they are blocking calls with a timeout. +struct close_after +{ + close_after(boost::asio::chrono::steady_clock::duration t, tcp::socket& s) + : timeout_(t), socket_(s) + { + } + + // The maximum time to wait for an asynchronous operation to complete. + boost::asio::chrono::steady_clock::duration timeout_; + + // The socket to be closed if the operation does not complete in time. + tcp::socket& socket_; +}; + +namespace boost { +namespace asio { + +// The async_result template is specialised to allow the close_after token to +// be used with asynchronous operations that have a completion signature of +// void(error_code, T). Generalising this for all completion signature forms is +// left as an exercise for the reader. +template <typename T> +class async_result<close_after, void(boost::system::error_code, T)> +{ +public: + // An asynchronous operation's initiating function automatically creates an + // completion_handler_type object from the token. This function object is + // then called on completion of the asynchronous operation. + class completion_handler_type + { + public: + completion_handler_type(const close_after& token) + : token_(token) + { + } + + void operator()(boost::system::error_code ec, T t) + { + *ec_ = ec; + *t_ = t; + } + + private: + friend class async_result; + close_after token_; + boost::system::error_code* ec_; + T* t_; + }; + + // The async_result constructor associates the completion handler object with + // the result of the initiating function. + explicit async_result(completion_handler_type& h) + : timeout_(h.token_.timeout_), + socket_(h.token_.socket_) + { + h.ec_ = &ec_; + h.t_ = &t_; + } + + // The return_type typedef determines the result type of the asynchronous + // operation's initiating function. + typedef T return_type; + + // The get() function is used to obtain the result of the asynchronous + // operation's initiating function. For the close_after completion token, we + // use this function to run the io_context until the operation is complete. + return_type get() + { + boost::asio::io_context& io_context = socket_.get_executor().context(); + + // Restart the io_context, as it may have been left in the "stopped" state + // by a previous operation. + io_context.restart(); + + // Block until the asynchronous operation has completed, or timed out. If + // the pending asynchronous operation is a composed operation, the deadline + // applies to the entire operation, rather than individual operations on + // the socket. + io_context.run_for(timeout_); + + // If the asynchronous operation completed successfully then the io_context + // would have been stopped due to running out of work. If it was not + // stopped, then the io_context::run_for call must have timed out and the + // operation is still incomplete. + if (!io_context.stopped()) + { + // Close the socket to cancel the outstanding asynchronous operation. + socket_.close(); + + // Run the io_context again until the operation completes. + io_context.run(); + } + + // If the operation failed, throw an exception. Otherwise return the result. + return ec_ ? throw boost::system::system_error(ec_) : t_; + } + +private: + boost::asio::chrono::steady_clock::duration timeout_; + tcp::socket& socket_; + boost::system::error_code ec_; + T t_; +}; + +} // namespace asio +} // namespace boost + +//---------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + try + { + if (argc != 4) + { + std::cerr << "Usage: blocking_tcp_client <host> <port> <message>\n"; + return 1; + } + + boost::asio::io_context io_context; + + // Resolve the host name and service to a list of endpoints. + tcp::resolver::results_type endpoints = + tcp::resolver(io_context).resolve(argv[1], argv[2]); + + tcp::socket socket(io_context); + + // Run an asynchronous connect operation with a timeout. + boost::asio::async_connect(socket, endpoints, + close_after(boost::asio::chrono::seconds(10), socket)); + + boost::asio::chrono::steady_clock::time_point time_sent = + boost::asio::chrono::steady_clock::now(); + + // Run an asynchronous write operation with a timeout. + std::string msg = argv[3] + std::string("\n"); + boost::asio::async_write(socket, boost::asio::buffer(msg), + close_after(boost::asio::chrono::seconds(10), socket)); + + for (std::string input_buffer;;) + { + // Run an asynchronous read operation with a timeout. + std::size_t n = boost::asio::async_read_until(socket, + boost::asio::dynamic_buffer(input_buffer), '\n', + close_after(boost::asio::chrono::seconds(10), socket)); + + std::string line(input_buffer.substr(0, n - 1)); + input_buffer.erase(0, n); + + // Keep going until we get back the line that was sent. + if (line == argv[3]) + break; + } + + boost::asio::chrono::steady_clock::time_point time_received = + boost::asio::chrono::steady_clock::now(); + + std::cout << "Round trip time: "; + std::cout << boost::asio::chrono::duration_cast< + boost::asio::chrono::microseconds>( + time_received - time_sent).count(); + std::cout << " microseconds\n"; + } + catch (std::exception& e) + { + std::cerr << "Exception: " << e.what() << "\n"; + } + + return 0; +} diff --git a/doc/html/boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp b/doc/html/boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp index 03aafca2f7..7630e8da26 100644 --- a/doc/html/boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp +++ b/doc/html/boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp @@ -2,42 +2,28 @@ // blocking_udp_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/asio/deadline_timer.hpp> +#include <boost/asio/buffer.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/udp.hpp> #include <cstdlib> #include <boost/bind.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> #include <iostream> -using boost::asio::deadline_timer; using boost::asio::ip::udp; //---------------------------------------------------------------------- // -// This class manages socket timeouts by applying the concept of a deadline. -// Each asynchronous operation is given a deadline by which it must complete. -// Deadlines are enforced by an "actor" that persists for the lifetime of the -// client object: -// -// +----------------+ -// | | -// | check_deadline |<---+ -// | | | -// +----------------+ | async_wait() -// | | -// +---------+ -// -// If the actor determines that the deadline has expired, any outstanding -// socket operations are cancelled. The socket operations themselves are -// implemented as transient actors: +// This class manages socket timeouts by running the io_context using the timed +// io_context::run_for() member function. Each asynchronous operation is given +// a timeout within which it must complete. The socket operations themselves +// use boost::bind to specify the completion handler: // // +---------------+ // | | @@ -51,73 +37,59 @@ using boost::asio::ip::udp; // | | // +----------------+ // -// The client object runs the io_context to block thread execution until the -// actor completes. +// For a given socket operation, the client object runs the io_context to block +// thread execution until the operation completes or the timeout is reached. If +// the io_context::run_for() function times out, the socket is closed and the +// outstanding asynchronous operation is cancelled. // class client { public: client(const udp::endpoint& listen_endpoint) - : socket_(io_context_, listen_endpoint), - deadline_(io_context_) + : socket_(io_context_, listen_endpoint) { - // No deadline is required until the first socket operation is started. We - // set the deadline to positive infinity so that the actor takes no action - // until a specific deadline is set. - deadline_.expires_at(boost::posix_time::pos_infin); - - // Start the persistent actor that checks for deadline expiry. - check_deadline(); } std::size_t receive(const boost::asio::mutable_buffer& buffer, - boost::posix_time::time_duration timeout, boost::system::error_code& ec) + boost::asio::chrono::steady_clock::duration timeout, + boost::system::error_code& ec) { - // Set a deadline for the asynchronous operation. - deadline_.expires_from_now(timeout); - - // Set up the variables that receive the result of the asynchronous - // operation. The error code is set to would_block to signal that the - // operation is incomplete. Asio guarantees that its asynchronous - // operations will never fail with would_block, so any other value in - // ec indicates completion. - ec = boost::asio::error::would_block; + // Start the asynchronous operation. The handle_receive function used as a + // callback will update the ec and length variables. std::size_t length = 0; - - // Start the asynchronous operation itself. The handle_receive function - // used as a callback will update the ec and length variables. socket_.async_receive(boost::asio::buffer(buffer), boost::bind(&client::handle_receive, _1, _2, &ec, &length)); - // Block until the asynchronous operation has completed. - do io_context_.run_one(); while (ec == boost::asio::error::would_block); + // Run the operation until it completes, or until the timeout. + run(timeout); return length; } private: - void check_deadline() + void run(boost::asio::chrono::steady_clock::duration timeout) { - // Check whether the deadline has passed. We compare the deadline against - // the current time since a new asynchronous operation may have moved the - // deadline before this actor had a chance to run. - if (deadline_.expires_at() <= deadline_timer::traits_type::now()) + // Restart the io_context, as it may have been left in the "stopped" state + // by a previous operation. + io_context_.restart(); + + // Block until the asynchronous operation has completed, or timed out. If + // the pending asynchronous operation is a composed operation, the deadline + // applies to the entire operation, rather than individual operations on + // the socket. + io_context_.run_for(timeout); + + // If the asynchronous operation completed successfully then the io_context + // would have been stopped due to running out of work. If it was not + // stopped, then the io_context::run_for call must have timed out. + if (!io_context_.stopped()) { - // The deadline has passed. The outstanding asynchronous operation needs - // to be cancelled so that the blocked receive() function will return. - // - // Please note that cancel() has portability issues on some versions of - // Microsoft Windows, and it may be necessary to use close() instead. - // Consult the documentation for cancel() for further information. + // Cancel the outstanding asynchronous operation. socket_.cancel(); - // There is no longer an active deadline. The expiry is set to positive - // infinity so that the actor takes no action until a new deadline is set. - deadline_.expires_at(boost::posix_time::pos_infin); + // Run the io_context again until the operation completes. + io_context_.run(); } - - // Put the actor back to sleep. - deadline_.async_wait(boost::bind(&client::check_deadline, this)); } static void handle_receive( @@ -131,7 +103,6 @@ private: private: boost::asio::io_context io_context_; udp::socket socket_; - deadline_timer deadline_; }; //---------------------------------------------------------------------- @@ -144,7 +115,7 @@ int main(int argc, char* argv[]) if (argc != 3) { - std::cerr << "Usage: blocking_udp_timeout <listen_addr> <listen_port>\n"; + std::cerr << "Usage: blocking_udp_client <listen_addr> <listen_port>\n"; return 1; } @@ -159,7 +130,7 @@ int main(int argc, char* argv[]) char data[1024]; boost::system::error_code ec; std::size_t n = c.receive(boost::asio::buffer(data), - boost::posix_time::seconds(10), ec); + boost::asio::chrono::seconds(10), ec); if (ec) { diff --git a/doc/html/boost_asio/example/cpp03/timeouts/server.cpp b/doc/html/boost_asio/example/cpp03/timeouts/server.cpp index 23c276521e..be85fc2dbe 100644 --- a/doc/html/boost_asio/example/cpp03/timeouts/server.cpp +++ b/doc/html/boost_asio/example/cpp03/timeouts/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -13,18 +13,19 @@ #include <deque> #include <iostream> #include <set> +#include <string> #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> -#include <boost/asio/deadline_timer.hpp> +#include <boost/asio/buffer.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/ip/udp.hpp> #include <boost/asio/read_until.hpp> -#include <boost/asio/streambuf.hpp> +#include <boost/asio/steady_timer.hpp> #include <boost/asio/write.hpp> -using boost::asio::deadline_timer; +using boost::asio::steady_timer; using boost::asio::ip::tcp; using boost::asio::ip::udp; @@ -121,8 +122,8 @@ private: // +-------------+ +--------------+ // // The output actor first waits for an output message to be enqueued. It does -// this by using a deadline_timer as an asynchronous condition variable. The -// deadline_timer will be signalled whenever the output queue is non-empty. +// this by using a steady_timer as an asynchronous condition variable. The +// steady_timer will be signalled whenever the output queue is non-empty. // // Once a message is available, it is sent to the client. The deadline for // sending a complete message is 30 seconds. After the message is successfully @@ -140,13 +141,13 @@ public: non_empty_output_queue_(io_context), output_deadline_(io_context) { - input_deadline_.expires_at(boost::posix_time::pos_infin); - output_deadline_.expires_at(boost::posix_time::pos_infin); + input_deadline_.expires_at(steady_timer::time_point::max()); + output_deadline_.expires_at(steady_timer::time_point::max()); - // The non_empty_output_queue_ deadline_timer is set to pos_infin whenever - // the output queue is empty. This ensures that the output actor stays - // asleep until a message is put into the queue. - non_empty_output_queue_.expires_at(boost::posix_time::pos_infin); + // The non_empty_output_queue_ steady_timer is set to the maximum time + // point whenever the output queue is empty. This ensures that the output + // actor stays asleep until a message is put into the queue. + non_empty_output_queue_.expires_at(steady_timer::time_point::max()); } tcp::socket& socket() @@ -195,20 +196,21 @@ private: // Signal that the output queue contains messages. Modifying the expiry // will wake the output actor, if it is waiting on the timer. - non_empty_output_queue_.expires_at(boost::posix_time::neg_infin); + non_empty_output_queue_.expires_at(steady_timer::time_point::min()); } void start_read() { // Set a deadline for the read operation. - input_deadline_.expires_from_now(boost::posix_time::seconds(30)); + input_deadline_.expires_after(boost::asio::chrono::seconds(30)); // Start an asynchronous operation to read a newline-delimited message. - boost::asio::async_read_until(socket_, input_buffer_, '\n', - boost::bind(&tcp_session::handle_read, shared_from_this(), _1)); + boost::asio::async_read_until(socket_, + boost::asio::dynamic_buffer(input_buffer_), '\n', + boost::bind(&tcp_session::handle_read, shared_from_this(), _1, _2)); } - void handle_read(const boost::system::error_code& ec) + void handle_read(const boost::system::error_code& ec, std::size_t n) { if (stopped()) return; @@ -216,9 +218,8 @@ private: if (!ec) { // Extract the newline-delimited message from the buffer. - std::string msg; - std::istream is(&input_buffer_); - std::getline(is, msg); + std::string msg(input_buffer_.substr(0, n - 1)); + input_buffer_.erase(0, n); if (!msg.empty()) { @@ -234,7 +235,7 @@ private: // Signal that the output queue contains messages. Modifying the // expiry will wake the output actor, if it is waiting on the timer. - non_empty_output_queue_.expires_at(boost::posix_time::neg_infin); + non_empty_output_queue_.expires_at(steady_timer::time_point::min()); } } @@ -256,7 +257,7 @@ private: // There are no messages that are ready to be sent. The actor goes to // sleep by waiting on the non_empty_output_queue_ timer. When a new // message is added, the timer will be modified and the actor will wake. - non_empty_output_queue_.expires_at(boost::posix_time::pos_infin); + non_empty_output_queue_.expires_at(steady_timer::time_point::max()); non_empty_output_queue_.async_wait( boost::bind(&tcp_session::await_output, shared_from_this())); } @@ -269,7 +270,7 @@ private: void start_write() { // Set a deadline for the write operation. - output_deadline_.expires_from_now(boost::posix_time::seconds(30)); + output_deadline_.expires_after(boost::asio::chrono::seconds(30)); // Start an asynchronous operation to send a message. boost::asio::async_write(socket_, @@ -294,7 +295,7 @@ private: } } - void check_deadline(deadline_timer* deadline) + void check_deadline(steady_timer* deadline) { if (stopped()) return; @@ -302,7 +303,7 @@ private: // Check whether the deadline has passed. We compare the deadline against // the current time since a new asynchronous operation may have moved the // deadline before this actor had a chance to run. - if (deadline->expires_at() <= deadline_timer::traits_type::now()) + if (deadline->expiry() <= steady_timer::clock_type::now()) { // The deadline has passed. Stop the session. The other actors will // terminate as soon as possible. @@ -319,11 +320,11 @@ private: channel& channel_; tcp::socket socket_; - boost::asio::streambuf input_buffer_; - deadline_timer input_deadline_; + std::string input_buffer_; + steady_timer input_deadline_; std::deque<std::string> output_queue_; - deadline_timer non_empty_output_queue_; - deadline_timer output_deadline_; + steady_timer non_empty_output_queue_; + steady_timer output_deadline_; }; typedef boost::shared_ptr<tcp_session> tcp_session_ptr; @@ -339,6 +340,7 @@ public: : socket_(io_context) { socket_.connect(broadcast_endpoint); + socket_.set_option(udp::socket::broadcast(true)); } private: diff --git a/doc/html/boost_asio/example/cpp03/timers/tick_count_timer.cpp b/doc/html/boost_asio/example/cpp03/timers/tick_count_timer.cpp deleted file mode 100644 index 8111a5cacd..0000000000 --- a/doc/html/boost_asio/example/cpp03/timers/tick_count_timer.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// -// tick_count_timer.cpp -// ~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#include <boost/asio.hpp> -#include <ctime> -#include <iostream> - -#if defined(WIN32) -# include <windows.h> -#else -# error This example is for Windows only! -#endif - -struct tick_count_traits -{ - // The time type. This type has no constructor that takes a DWORD to ensure - // that the timer can only be used with relative times. - class time_type - { - public: - time_type() : ticks_(0) {} - private: - friend struct tick_count_traits; - DWORD ticks_; - }; - - // The duration type. According to the TimeTraits requirements, the duration - // must be a signed type. This means we can't handle durations larger than - // 2^31. - class duration_type - { - public: - duration_type() : ticks_(0) {} - duration_type(LONG ticks) : ticks_(ticks) {} - private: - friend struct tick_count_traits; - LONG ticks_; - }; - - // Get the current time. - static time_type now() - { - time_type result; - result.ticks_ = ::GetTickCount(); - return result; - } - - // Add a duration to a time. - static time_type add(const time_type& t, const duration_type& d) - { - time_type result; - result.ticks_ = t.ticks_ + d.ticks_; - return result; - } - - // Subtract one time from another. - static duration_type subtract(const time_type& t1, const time_type& t2) - { - // DWORD tick count values can wrap (see less_than() below). We'll convert - // to a duration by taking the absolute difference and adding the sign - // based on which is the "lesser" absolute time. - return duration_type(less_than(t1, t2) - ? -static_cast<LONG>(t2.ticks_ - t1.ticks_) - : static_cast<LONG>(t1.ticks_ - t2.ticks_)); - } - - // Test whether one time is less than another. - static bool less_than(const time_type& t1, const time_type& t2) - { - // DWORD tick count values wrap periodically, so we'll use a heuristic that - // says that if subtracting t1 from t2 yields a value smaller than 2^31, - // then t1 is probably less than t2. This means that we can't handle - // durations larger than 2^31, which shouldn't be a problem in practice. - return (t2.ticks_ - t1.ticks_) < static_cast<DWORD>(1 << 31); - } - - // Convert to POSIX duration type. - static boost::posix_time::time_duration to_posix_duration( - const duration_type& d) - { - return boost::posix_time::milliseconds(d.ticks_); - } -}; - -typedef boost::asio::basic_deadline_timer< - DWORD, tick_count_traits> tick_count_timer; - -void handle_timeout(const boost::system::error_code&) -{ - std::cout << "handle_timeout\n"; -} - -int main() -{ - try - { - boost::asio::io_context io_context; - - tick_count_timer timer(io_context, 5000); - std::cout << "Starting synchronous wait\n"; - timer.wait(); - std::cout << "Finished synchronous wait\n"; - - timer.expires_from_now(5000); - std::cout << "Starting asynchronous wait\n"; - timer.async_wait(&handle_timeout); - io_context.run(); - std::cout << "Finished asynchronous wait\n"; - } - catch (std::exception& e) - { - std::cout << "Exception: " << e.what() << "\n"; - } - - return 0; -} diff --git a/doc/html/boost_asio/example/cpp03/timers/time_t_timer.cpp b/doc/html/boost_asio/example/cpp03/timers/time_t_timer.cpp index 95b443eccd..061ed81bf1 100644 --- a/doc/html/boost_asio/example/cpp03/timers/time_t_timer.cpp +++ b/doc/html/boost_asio/example/cpp03/timers/time_t_timer.cpp @@ -2,7 +2,7 @@ // time_t_timer.cpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,53 +12,66 @@ #include <ctime> #include <iostream> -struct time_t_traits +// A custom implementation of the Clock concept from the standard C++ library. +struct time_t_clock { - // The time type. - typedef std::time_t time_type; - // The duration type. - struct duration_type - { - duration_type() : value(0) {} - duration_type(std::time_t v) : value(v) {} - std::time_t value; - }; + typedef boost::asio::chrono::steady_clock::duration duration; - // Get the current time. - static time_type now() - { - return std::time(0); - } + // The duration's underlying arithmetic representation. + typedef duration::rep rep; - // Add a duration to a time. - static time_type add(const time_type& t, const duration_type& d) - { - return t + d.value; - } + // The ratio representing the duration's tick period. + typedef duration::period period; + + // An absolute time point represented using the clock. + typedef boost::asio::chrono::time_point<time_t_clock> time_point; + + // The clock is not monotonically increasing. + static const bool is_steady = false; - // Subtract one time from another. - static duration_type subtract(const time_type& t1, const time_type& t2) + // Get the current time. + static time_point now() { - return duration_type(t1 - t2); + return time_point() + boost::asio::chrono::seconds(std::time(0)); } +}; - // Test whether one time is less than another. - static bool less_than(const time_type& t1, const time_type& t2) +// The boost::asio::basic_waitable_timer template accepts an optional WaitTraits +// template parameter. The underlying time_t clock has one-second granularity, +// so these traits may be customised to reduce the latency between the clock +// ticking over and a wait operation's completion. When the timeout is near +// (less than one second away) we poll the clock more frequently to detect the +// time change closer to when it occurs. The user can select the appropriate +// trade off between accuracy and the increased CPU cost of polling. In extreme +// cases, a zero duration may be returned to make the timers as accurate as +// possible, albeit with 100% CPU usage. +struct time_t_wait_traits +{ + // Determine how long until the clock should be next polled to determine + // whether the duration has elapsed. + static time_t_clock::duration to_wait_duration( + const time_t_clock::duration& d) { - return t1 < t2; + if (d > boost::asio::chrono::seconds(1)) + return d - boost::asio::chrono::seconds(1); + else if (d > boost::asio::chrono::seconds(0)) + return boost::asio::chrono::milliseconds(10); + else + return boost::asio::chrono::seconds(0); } - // Convert to POSIX duration type. - static boost::posix_time::time_duration to_posix_duration( - const duration_type& d) + // Determine how long until the clock should be next polled to determine + // whether the absoluate time has been reached. + static time_t_clock::duration to_wait_duration( + const time_t_clock::time_point& t) { - return boost::posix_time::seconds(d.value); + return to_wait_duration(t - time_t_clock::now()); } }; -typedef boost::asio::basic_deadline_timer< - std::time_t, time_t_traits> time_t_timer; +typedef boost::asio::basic_waitable_timer< + time_t_clock, time_t_wait_traits> time_t_timer; void handle_timeout(const boost::system::error_code&) { @@ -73,12 +86,12 @@ int main() time_t_timer timer(io_context); - timer.expires_from_now(5); + timer.expires_after(boost::asio::chrono::seconds(5)); std::cout << "Starting synchronous wait\n"; timer.wait(); std::cout << "Finished synchronous wait\n"; - timer.expires_from_now(5); + timer.expires_after(boost::asio::chrono::seconds(5)); std::cout << "Starting asynchronous wait\n"; timer.async_wait(&handle_timeout); io_context.run(); diff --git a/doc/html/boost_asio/example/cpp03/windows/transmit_file.cpp b/doc/html/boost_asio/example/cpp03/windows/transmit_file.cpp index 38ff8a9d60..2f2f05c735 100644 --- a/doc/html/boost_asio/example/cpp03/windows/transmit_file.cpp +++ b/doc/html/boost_asio/example/cpp03/windows/transmit_file.cpp @@ -2,7 +2,7 @@ // transmit_file.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/allocation/server.cpp b/doc/html/boost_asio/example/cpp11/allocation/server.cpp index 5be7508dcc..fc1b03eaa3 100644 --- a/doc/html/boost_asio/example/cpp11/allocation/server.cpp +++ b/doc/html/boost_asio/example/cpp11/allocation/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/buffers/reference_counted.cpp b/doc/html/boost_asio/example/cpp11/buffers/reference_counted.cpp index 462d5f04e1..e56778f249 100644 --- a/doc/html/boost_asio/example/cpp11/buffers/reference_counted.cpp +++ b/doc/html/boost_asio/example/cpp11/buffers/reference_counted.cpp @@ -2,7 +2,7 @@ // reference_counted.cpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -13,6 +13,7 @@ #include <memory> #include <utility> #include <vector> +#include <ctime> using boost::asio::ip::tcp; diff --git a/doc/html/boost_asio/example/cpp11/chat/chat_client.cpp b/doc/html/boost_asio/example/cpp11/chat/chat_client.cpp index a422e0f9f8..5ee9464cef 100644 --- a/doc/html/boost_asio/example/cpp11/chat/chat_client.cpp +++ b/doc/html/boost_asio/example/cpp11/chat/chat_client.cpp @@ -2,7 +2,7 @@ // chat_client.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/chat/chat_message.hpp b/doc/html/boost_asio/example/cpp11/chat/chat_message.hpp index d2edd1cc76..629105b05b 100644 --- a/doc/html/boost_asio/example/cpp11/chat/chat_message.hpp +++ b/doc/html/boost_asio/example/cpp11/chat/chat_message.hpp @@ -2,7 +2,7 @@ // chat_message.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/chat/chat_server.cpp b/doc/html/boost_asio/example/cpp11/chat/chat_server.cpp index 4db62b4ba3..6253ff2de9 100644 --- a/doc/html/boost_asio/example/cpp11/chat/chat_server.cpp +++ b/doc/html/boost_asio/example/cpp11/chat/chat_server.cpp @@ -2,7 +2,7 @@ // chat_server.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp b/doc/html/boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp index 14a3810a63..34fbb48808 100644 --- a/doc/html/boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp @@ -2,7 +2,7 @@ // async_tcp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/async_udp_echo_server.cpp b/doc/html/boost_asio/example/cpp11/echo/async_udp_echo_server.cpp index 3e0ab89586..d6e6587ee4 100644 --- a/doc/html/boost_asio/example/cpp11/echo/async_udp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/async_udp_echo_server.cpp @@ -2,7 +2,7 @@ // async_udp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp b/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp index 557b14e41d..fe6c447b39 100644 --- a/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp @@ -2,7 +2,7 @@ // blocking_tcp_echo_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp b/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp index 44c69c0dae..c00a585242 100644 --- a/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp @@ -2,7 +2,7 @@ // blocking_tcp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp b/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp index 8be33a0688..887891a737 100644 --- a/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp @@ -2,7 +2,7 @@ // blocking_udp_echo_client.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp b/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp index 6626d74d82..0941b0c8d4 100644 --- a/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp @@ -2,7 +2,7 @@ // blocking_udp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/executors/fork_join.cpp b/doc/html/boost_asio/example/cpp11/executors/fork_join.cpp index 4cfd5e6fca..98926d53fe 100644 --- a/doc/html/boost_asio/example/cpp11/executors/fork_join.cpp +++ b/doc/html/boost_asio/example/cpp11/executors/fork_join.cpp @@ -6,6 +6,7 @@ #include <mutex> #include <queue> #include <thread> +#include <numeric> using boost::asio::dispatch; using boost::asio::execution_context; diff --git a/doc/html/boost_asio/example/cpp11/executors/pipeline.cpp b/doc/html/boost_asio/example/cpp11/executors/pipeline.cpp index 52b70cad56..9c2a778fee 100644 --- a/doc/html/boost_asio/example/cpp11/executors/pipeline.cpp +++ b/doc/html/boost_asio/example/cpp11/executors/pipeline.cpp @@ -11,6 +11,7 @@ #include <queue> #include <thread> #include <vector> +#include <cctype> using boost::asio::execution_context; using boost::asio::executor_binder; diff --git a/doc/html/boost_asio/example/cpp11/fork/daemon.cpp b/doc/html/boost_asio/example/cpp11/fork/daemon.cpp index 4e0557365b..2661926220 100644 --- a/doc/html/boost_asio/example/cpp11/fork/daemon.cpp +++ b/doc/html/boost_asio/example/cpp11/fork/daemon.cpp @@ -2,7 +2,7 @@ // daemon.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/fork/process_per_connection.cpp b/doc/html/boost_asio/example/cpp11/fork/process_per_connection.cpp index 5f68c12d89..3608c440da 100644 --- a/doc/html/boost_asio/example/cpp11/fork/process_per_connection.cpp +++ b/doc/html/boost_asio/example/cpp11/fork/process_per_connection.cpp @@ -2,7 +2,7 @@ // process_per_connection.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/futures/daytime_client.cpp b/doc/html/boost_asio/example/cpp11/futures/daytime_client.cpp index 2ec8a67290..1e49fc87d3 100644 --- a/doc/html/boost_asio/example/cpp11/futures/daytime_client.cpp +++ b/doc/html/boost_asio/example/cpp11/futures/daytime_client.cpp @@ -2,7 +2,7 @@ // daytime_client.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/handler_tracking/async_tcp_echo_server.cpp b/doc/html/boost_asio/example/cpp11/handler_tracking/async_tcp_echo_server.cpp index 14a3810a63..34fbb48808 100644 --- a/doc/html/boost_asio/example/cpp11/handler_tracking/async_tcp_echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/handler_tracking/async_tcp_echo_server.cpp @@ -2,7 +2,7 @@ // async_tcp_echo_server.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/handler_tracking/custom_tracking.hpp b/doc/html/boost_asio/example/cpp11/handler_tracking/custom_tracking.hpp index 7e039b5562..997e1588c3 100644 --- a/doc/html/boost_asio/example/cpp11/handler_tracking/custom_tracking.hpp +++ b/doc/html/boost_asio/example/cpp11/handler_tracking/custom_tracking.hpp @@ -2,7 +2,7 @@ // custom_tracking.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/connection.cpp b/doc/html/boost_asio/example/cpp11/http/server/connection.cpp index 733fe69d27..5eed24764e 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/connection.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/connection.cpp @@ -2,7 +2,7 @@ // connection.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/connection.hpp b/doc/html/boost_asio/example/cpp11/http/server/connection.hpp index d459e5f8cc..5f3ce5c377 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/connection.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/connection.hpp @@ -2,7 +2,7 @@ // connection.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/connection_manager.cpp b/doc/html/boost_asio/example/cpp11/http/server/connection_manager.cpp index e3e18ca7a1..ac862994b5 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/connection_manager.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/connection_manager.cpp @@ -2,7 +2,7 @@ // connection_manager.cpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/connection_manager.hpp b/doc/html/boost_asio/example/cpp11/http/server/connection_manager.hpp index 617a54f1ba..027b9e92d8 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/connection_manager.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/connection_manager.hpp @@ -2,7 +2,7 @@ // connection_manager.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/header.hpp b/doc/html/boost_asio/example/cpp11/http/server/header.hpp index 877211f190..18bad986a4 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/header.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/header.hpp @@ -2,7 +2,7 @@ // header.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/main.cpp b/doc/html/boost_asio/example/cpp11/http/server/main.cpp index fcc72ecc93..15cffd5234 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/main.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/main.cpp @@ -2,7 +2,7 @@ // main.cpp // ~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/mime_types.cpp b/doc/html/boost_asio/example/cpp11/http/server/mime_types.cpp index c05ee4b656..0762cf7fea 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/mime_types.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/mime_types.cpp @@ -2,7 +2,7 @@ // mime_types.cpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/mime_types.hpp b/doc/html/boost_asio/example/cpp11/http/server/mime_types.hpp index 891c443669..a5f352e69a 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/mime_types.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/mime_types.hpp @@ -2,7 +2,7 @@ // mime_types.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/reply.cpp b/doc/html/boost_asio/example/cpp11/http/server/reply.cpp index c7e9b9f2b7..e1e23daaa6 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/reply.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/reply.cpp @@ -2,7 +2,7 @@ // reply.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/reply.hpp b/doc/html/boost_asio/example/cpp11/http/server/reply.hpp index 51d495bc65..03293227e7 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/reply.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/reply.hpp @@ -2,7 +2,7 @@ // reply.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/request.hpp b/doc/html/boost_asio/example/cpp11/http/server/request.hpp index 20efff4dd3..6488b1ddeb 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/request.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/request.hpp @@ -2,7 +2,7 @@ // request.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/request_handler.cpp b/doc/html/boost_asio/example/cpp11/http/server/request_handler.cpp index 419c62b5ae..04a5959b12 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/request_handler.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/request_handler.cpp @@ -2,7 +2,7 @@ // request_handler.cpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/request_handler.hpp b/doc/html/boost_asio/example/cpp11/http/server/request_handler.hpp index e2dff5c26c..82bd61392a 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/request_handler.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/request_handler.hpp @@ -2,7 +2,7 @@ // request_handler.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/request_parser.cpp b/doc/html/boost_asio/example/cpp11/http/server/request_parser.cpp index 2104034ea7..4b148c5af6 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/request_parser.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/request_parser.cpp @@ -2,7 +2,7 @@ // request_parser.cpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/request_parser.hpp b/doc/html/boost_asio/example/cpp11/http/server/request_parser.hpp index 2c1d05ab04..aaae6b9539 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/request_parser.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/request_parser.hpp @@ -2,7 +2,7 @@ // request_parser.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/server.cpp b/doc/html/boost_asio/example/cpp11/http/server/server.cpp index df453b8ed2..ce415b80fd 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/server.cpp +++ b/doc/html/boost_asio/example/cpp11/http/server/server.cpp @@ -2,7 +2,7 @@ // server.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/http/server/server.hpp b/doc/html/boost_asio/example/cpp11/http/server/server.hpp index 7b8aee0c5d..820b46bc13 100644 --- a/doc/html/boost_asio/example/cpp11/http/server/server.hpp +++ b/doc/html/boost_asio/example/cpp11/http/server/server.hpp @@ -2,7 +2,7 @@ // server.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/invocation/prioritised_handlers.cpp b/doc/html/boost_asio/example/cpp11/invocation/prioritised_handlers.cpp index d7ef7b1ff4..99ea7454f2 100644 --- a/doc/html/boost_asio/example/cpp11/invocation/prioritised_handlers.cpp +++ b/doc/html/boost_asio/example/cpp11/invocation/prioritised_handlers.cpp @@ -2,7 +2,7 @@ // prioritised_handlers.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/local/connect_pair.cpp b/doc/html/boost_asio/example/cpp11/local/connect_pair.cpp index 727b12f850..ad5428dd66 100644 --- a/doc/html/boost_asio/example/cpp11/local/connect_pair.cpp +++ b/doc/html/boost_asio/example/cpp11/local/connect_pair.cpp @@ -2,7 +2,7 @@ // connect_pair.cpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/local/iostream_client.cpp b/doc/html/boost_asio/example/cpp11/local/iostream_client.cpp index 57c0faf86e..7bab1d39fa 100644 --- a/doc/html/boost_asio/example/cpp11/local/iostream_client.cpp +++ b/doc/html/boost_asio/example/cpp11/local/iostream_client.cpp @@ -2,7 +2,7 @@ // stream_client.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/local/stream_client.cpp b/doc/html/boost_asio/example/cpp11/local/stream_client.cpp index 234d190b8e..0faf617ea7 100644 --- a/doc/html/boost_asio/example/cpp11/local/stream_client.cpp +++ b/doc/html/boost_asio/example/cpp11/local/stream_client.cpp @@ -2,7 +2,7 @@ // stream_client.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/local/stream_server.cpp b/doc/html/boost_asio/example/cpp11/local/stream_server.cpp index 7413773a8f..abfdf3d2fc 100644 --- a/doc/html/boost_asio/example/cpp11/local/stream_server.cpp +++ b/doc/html/boost_asio/example/cpp11/local/stream_server.cpp @@ -2,7 +2,7 @@ // stream_server.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/multicast/receiver.cpp b/doc/html/boost_asio/example/cpp11/multicast/receiver.cpp index f77266e871..d785265b6c 100644 --- a/doc/html/boost_asio/example/cpp11/multicast/receiver.cpp +++ b/doc/html/boost_asio/example/cpp11/multicast/receiver.cpp @@ -2,7 +2,7 @@ // receiver.cpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/multicast/sender.cpp b/doc/html/boost_asio/example/cpp11/multicast/sender.cpp index 41f59d89b7..7b52e4ebe3 100644 --- a/doc/html/boost_asio/example/cpp11/multicast/sender.cpp +++ b/doc/html/boost_asio/example/cpp11/multicast/sender.cpp @@ -2,7 +2,7 @@ // sender.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp b/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp index 350304e63e..979c9a9273 100644 --- a/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp +++ b/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp @@ -2,7 +2,7 @@ // echo_server.cpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp11/spawn/parallel_grep.cpp b/doc/html/boost_asio/example/cpp11/spawn/parallel_grep.cpp index b15173be2c..e4af2624e7 100644 --- a/doc/html/boost_asio/example/cpp11/spawn/parallel_grep.cpp +++ b/doc/html/boost_asio/example/cpp11/spawn/parallel_grep.cpp @@ -2,7 +2,7 @@ // parallel_grep.cpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp b/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp new file mode 100644 index 0000000000..cf6260ea57 --- /dev/null +++ b/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp @@ -0,0 +1,224 @@ +// +// chat_server.cpp +// ~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <cstdlib> +#include <deque> +#include <iostream> +#include <list> +#include <memory> +#include <set> +#include <string> +#include <utility> +#include <boost/asio/experimental.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/read_until.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/steady_timer.hpp> +#include <boost/asio/write.hpp> + +using boost::asio::ip::tcp; +using boost::asio::experimental::awaitable; +using boost::asio::experimental::co_spawn; +using boost::asio::experimental::detached; +using boost::asio::experimental::redirect_error; +namespace this_coro = boost::asio::experimental::this_coro; + +//---------------------------------------------------------------------- + +class chat_participant +{ +public: + virtual ~chat_participant() {} + virtual void deliver(const std::string& msg) = 0; +}; + +typedef std::shared_ptr<chat_participant> chat_participant_ptr; + +//---------------------------------------------------------------------- + +class chat_room +{ +public: + void join(chat_participant_ptr participant) + { + participants_.insert(participant); + for (auto msg: recent_msgs_) + participant->deliver(msg); + } + + void leave(chat_participant_ptr participant) + { + participants_.erase(participant); + } + + void deliver(const std::string& msg) + { + recent_msgs_.push_back(msg); + while (recent_msgs_.size() > max_recent_msgs) + recent_msgs_.pop_front(); + + for (auto participant: participants_) + participant->deliver(msg); + } + +private: + std::set<chat_participant_ptr> participants_; + enum { max_recent_msgs = 100 }; + std::deque<std::string> recent_msgs_; +}; + +//---------------------------------------------------------------------- + +class chat_session + : public chat_participant, + public std::enable_shared_from_this<chat_session> +{ +public: + chat_session(tcp::socket socket, chat_room& room) + : socket_(std::move(socket)), + timer_(socket_.get_executor().context()), + room_(room) + { + timer_.expires_at(std::chrono::steady_clock::time_point::max()); + } + + void start() + { + room_.join(shared_from_this()); + + co_spawn(socket_.get_executor(), + [self = shared_from_this()]{ return self->reader(); }, + detached); + + co_spawn(socket_.get_executor(), + [self = shared_from_this()]{ return self->writer(); }, + detached); + } + + void deliver(const std::string& msg) + { + write_msgs_.push_back(msg); + timer_.cancel_one(); + } + +private: + awaitable<void> reader() + { + auto token = co_await this_coro::token(); + + try + { + for (std::string read_msg;;) + { + std::size_t n = co_await boost::asio::async_read_until(socket_, + boost::asio::dynamic_buffer(read_msg, 1024), "\n", token); + + room_.deliver(read_msg.substr(0, n)); + read_msg.erase(0, n); + } + } + catch (std::exception&) + { + stop(); + } + } + + awaitable<void> writer() + { + auto token = co_await this_coro::token(); + + try + { + while (socket_.is_open()) + { + if (write_msgs_.empty()) + { + boost::system::error_code ec; + co_await timer_.async_wait(redirect_error(token, ec)); + } + else + { + co_await boost::asio::async_write(socket_, + boost::asio::buffer(write_msgs_.front()), token); + write_msgs_.pop_front(); + } + } + } + catch (std::exception&) + { + stop(); + } + } + + void stop() + { + room_.leave(shared_from_this()); + socket_.close(); + timer_.cancel(); + } + + tcp::socket socket_; + boost::asio::steady_timer timer_; + chat_room& room_; + std::deque<std::string> write_msgs_; +}; + +//---------------------------------------------------------------------- + +awaitable<void> listener(tcp::acceptor acceptor) +{ + auto token = co_await this_coro::token(); + + chat_room room; + + for (;;) + { + std::make_shared<chat_session>( + co_await acceptor.async_accept(token), + room + )->start(); + } +} + +//---------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + try + { + if (argc < 2) + { + std::cerr << "Usage: chat_server <port> [<port> ...]\n"; + return 1; + } + + boost::asio::io_context io_context(1); + + for (int i = 1; i < argc; ++i) + { + unsigned short port = std::atoi(argv[i]); + co_spawn(io_context, + [&]{ return listener(tcp::acceptor(io_context, {tcp::v4(), port})); }, + detached); + } + + boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); + signals.async_wait([&](auto, auto){ io_context.stop(); }); + + io_context.run(); + } + catch (std::exception& e) + { + std::cerr << "Exception: " << e.what() << "\n"; + } + + return 0; +} diff --git a/doc/html/boost_asio/example/cpp17/coroutines_ts/double_buffered_echo_server.cpp b/doc/html/boost_asio/example/cpp17/coroutines_ts/double_buffered_echo_server.cpp new file mode 100644 index 0000000000..2355df29c0 --- /dev/null +++ b/doc/html/boost_asio/example/cpp17/coroutines_ts/double_buffered_echo_server.cpp @@ -0,0 +1,97 @@ +// +// double_buffered_echo_server.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/asio/experimental/co_spawn.hpp> +#include <boost/asio/experimental/detached.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/write.hpp> +#include <cstdio> + +using boost::asio::ip::tcp; +using boost::asio::experimental::co_spawn; +using boost::asio::experimental::detached; +namespace this_coro = boost::asio::experimental::this_coro; + +template <typename T> + using awaitable = boost::asio::experimental::awaitable< + T, boost::asio::io_context::executor_type>; + +awaitable<void> echo(tcp::socket s) +{ + auto token = co_await this_coro::token(); + + try + { + char data1[1024]; + char data2[1024]; + + char* p1 = data1; + char* p2 = data2; + + // Perform initial read into first buffer. + size_t n = co_await s.async_read_some(boost::asio::buffer(p1, 1024), token); + + for (;;) + { + // Swap received data to other buffer and initiate write operation. + std::swap(p1, p2); + auto write_result = boost::asio::async_write(s, boost::asio::buffer(p2, n), token); + + // Perform next read while write operation is in progress. + n = co_await s.async_read_some(boost::asio::buffer(p1, 1024), token); + + // Wait for write operation to complete before proceeding. + co_await write_result; + } + } + catch (std::exception& e) + { + std::printf("echo Exception: %s\n", e.what()); + } +} + +awaitable<void> listener() +{ + auto executor = co_await this_coro::executor(); + auto token = co_await this_coro::token(); + + tcp::acceptor acceptor(executor.context(), {tcp::v4(), 55555}); + for (;;) + { + tcp::socket socket = co_await acceptor.async_accept(token); + co_spawn(executor, + [socket = std::move(socket)]() mutable + { + return echo(std::move(socket)); + }, + detached); + } +} + +int main() +{ + try + { + boost::asio::io_context io_context(1); + + boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); + signals.async_wait([&](auto, auto){ io_context.stop(); }); + + co_spawn(io_context, listener, detached); + + io_context.run(); + } + catch (std::exception& e) + { + std::printf("Exception: %s\n", e.what()); + } +} diff --git a/doc/html/boost_asio/example/cpp17/coroutines_ts/echo_server.cpp b/doc/html/boost_asio/example/cpp17/coroutines_ts/echo_server.cpp new file mode 100644 index 0000000000..7f663effe9 --- /dev/null +++ b/doc/html/boost_asio/example/cpp17/coroutines_ts/echo_server.cpp @@ -0,0 +1,82 @@ +// +// echo_server.cpp +// ~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/asio/experimental/co_spawn.hpp> +#include <boost/asio/experimental/detached.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/write.hpp> +#include <cstdio> + +using boost::asio::ip::tcp; +using boost::asio::experimental::co_spawn; +using boost::asio::experimental::detached; +namespace this_coro = boost::asio::experimental::this_coro; + +template <typename T> + using awaitable = boost::asio::experimental::awaitable< + T, boost::asio::io_context::executor_type>; + +awaitable<void> echo(tcp::socket socket) +{ + auto token = co_await this_coro::token(); + + try + { + char data[1024]; + for (;;) + { + std::size_t n = co_await socket.async_read_some(boost::asio::buffer(data), token); + co_await async_write(socket, boost::asio::buffer(data, n), token); + } + } + catch (std::exception& e) + { + std::printf("echo Exception: %s\n", e.what()); + } +} + +awaitable<void> listener() +{ + auto executor = co_await this_coro::executor(); + auto token = co_await this_coro::token(); + + tcp::acceptor acceptor(executor.context(), {tcp::v4(), 55555}); + for (;;) + { + tcp::socket socket = co_await acceptor.async_accept(token); + co_spawn(executor, + [socket = std::move(socket)]() mutable + { + return echo(std::move(socket)); + }, + detached); + } +} + +int main() +{ + try + { + boost::asio::io_context io_context(1); + + boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); + signals.async_wait([&](auto, auto){ io_context.stop(); }); + + co_spawn(io_context, listener, detached); + + io_context.run(); + } + catch (std::exception& e) + { + std::printf("Exception: %s\n", e.what()); + } +} diff --git a/doc/html/boost_asio/example/cpp17/coroutines_ts/range_based_for.cpp b/doc/html/boost_asio/example/cpp17/coroutines_ts/range_based_for.cpp new file mode 100644 index 0000000000..a43f888395 --- /dev/null +++ b/doc/html/boost_asio/example/cpp17/coroutines_ts/range_based_for.cpp @@ -0,0 +1,111 @@ +// +// range_based_for.cpp +// ~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/asio/experimental/co_spawn.hpp> +#include <boost/asio/experimental/detached.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/write.hpp> +#include <cstdio> + +using boost::asio::ip::tcp; +using boost::asio::experimental::awaitable; +using boost::asio::experimental::co_spawn; +using boost::asio::experimental::detached; +namespace this_coro = boost::asio::experimental::this_coro; + +class connection_iter +{ + friend class connections; + tcp::acceptor* acceptor_ = nullptr; + tcp::socket socket_; + + connection_iter(tcp::acceptor& a, tcp::socket s) + : acceptor_(&a), socket_(std::move(s)) {} + +public: + tcp::socket operator*() + { + return std::move(socket_); + } + + awaitable<void> operator++() + { + auto token = co_await this_coro::token(); + socket_ = co_await acceptor_->async_accept(token); + } + + bool operator==(const connection_iter&) const noexcept + { + return false; + } + + bool operator!=(const connection_iter&) const noexcept + { + return true; + } +}; + +class connections +{ + tcp::acceptor& acceptor_; + +public: + explicit connections(tcp::acceptor& a) : acceptor_(a) {} + + awaitable<connection_iter> begin() + { + auto token = co_await this_coro::token(); + tcp::socket s = co_await acceptor_.async_accept(token); + co_return connection_iter(acceptor_, std::move(s)); + } + + connection_iter end() + { + return connection_iter(acceptor_, + tcp::socket(acceptor_.get_executor().context())); + } +}; + +awaitable<void> listener(tcp::acceptor acceptor) +{ + auto token = co_await this_coro::token(); + + for co_await (tcp::socket s : connections(acceptor)) + { + co_await boost::asio::async_write(s, boost::asio::buffer("hello\r\n", 7), token); + } +} + +int main() +{ + try + { + boost::asio::io_context io_context(1); + + boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); + signals.async_wait([&](auto, auto){ io_context.stop(); }); + + tcp::acceptor acceptor(io_context, {tcp::v4(), 55555}); + co_spawn(io_context, + [acceptor = std::move(acceptor)]() mutable + { + return listener(std::move(acceptor)); + }, + detached); + + io_context.run(); + } + catch (std::exception& e) + { + std::printf("Exception: %s\n", e.what()); + } +} diff --git a/doc/html/boost_asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp b/doc/html/boost_asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp new file mode 100644 index 0000000000..57bf3f379a --- /dev/null +++ b/doc/html/boost_asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp @@ -0,0 +1,91 @@ +// +// refactored_echo_server.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/asio/experimental/co_spawn.hpp> +#include <boost/asio/experimental/detached.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/write.hpp> +#include <cstdio> + +using boost::asio::ip::tcp; +using boost::asio::experimental::co_spawn; +using boost::asio::experimental::detached; +namespace this_coro = boost::asio::experimental::this_coro; + +template <typename T> + using awaitable = boost::asio::experimental::awaitable< + T, boost::asio::io_context::executor_type>; + +awaitable<void> echo_once(tcp::socket& socket) +{ + auto token = co_await this_coro::token(); + + char data[128]; + std::size_t n = co_await socket.async_read_some(boost::asio::buffer(data), token); + co_await async_write(socket, boost::asio::buffer(data, n), token); +} + +awaitable<void> echo(tcp::socket socket) +{ + try + { + for (;;) + { + // The asynchronous operations to echo a single chunk of data have been + // refactored into a separate function. When this function is called, the + // operations are still performed in the context of the current + // coroutine, and the behaviour is functionally equivalent. + co_await echo_once(socket); + } + } + catch (std::exception& e) + { + std::printf("echo Exception: %s\n", e.what()); + } +} + +awaitable<void> listener() +{ + auto executor = co_await this_coro::executor(); + auto token = co_await this_coro::token(); + + tcp::acceptor acceptor(executor.context(), {tcp::v4(), 55555}); + for (;;) + { + tcp::socket socket = co_await acceptor.async_accept(token); + co_spawn(executor, + [socket = std::move(socket)]() mutable + { + return echo(std::move(socket)); + }, + detached); + } +} + +int main() +{ + try + { + boost::asio::io_context io_context(1); + + boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); + signals.async_wait([&](auto, auto){ io_context.stop(); }); + + co_spawn(io_context, listener, detached); + + io_context.run(); + } + catch (std::exception& e) + { + std::printf("Exception: %s\n", e.what()); + } +} |