]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/example/cpp03/timeouts/blocking_udp_client.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp03 / timeouts / blocking_udp_client.cpp
index 8e20357ae54f54531b2b896c17002e2c4014dc14..03aafca2f70f32dd2237b00eaf0307bbae78e0ce 100644 (file)
@@ -2,14 +2,14 @@
 // blocking_udp_client.cpp
 // ~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// 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/deadline_timer.hpp>
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/ip/udp.hpp>
 #include <cstdlib>
 #include <boost/bind.hpp>
@@ -51,15 +51,15 @@ using boost::asio::ip::udp;
 //                |                |
 //                +----------------+
 //
-// The client object runs the io_service to block thread execution until the
+// The client object runs the io_context to block thread execution until the
 // actor completes.
 //
 class client
 {
 public:
   client(const udp::endpoint& listen_endpoint)
-    : socket_(io_service_, listen_endpoint),
-      deadline_(io_service_)
+    : socket_(io_context_, listen_endpoint),
+      deadline_(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
@@ -90,7 +90,7 @@ public:
         boost::bind(&client::handle_receive, _1, _2, &ec, &length));
 
     // Block until the asynchronous operation has completed.
-    do io_service_.run_one(); while (ec == boost::asio::error::would_block);
+    do io_context_.run_one(); while (ec == boost::asio::error::would_block);
 
     return length;
   }
@@ -129,7 +129,7 @@ private:
   }
 
 private:
-  boost::asio::io_service io_service_;
+  boost::asio::io_context io_context_;
   udp::socket socket_;
   deadline_timer deadline_;
 };
@@ -149,7 +149,7 @@ int main(int argc, char* argv[])
     }
 
     udp::endpoint listen_endpoint(
-        boost::asio::ip::address::from_string(argv[1]),
+        boost::asio::ip::make_address(argv[1]),
         std::atoi(argv[2]));
 
     client c(listen_endpoint);