]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/example/cpp03/socks4/sync_client.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp03 / socks4 / sync_client.cpp
index b5dec53a77a8be3f859f06869c733be6e8a88d30..e9106a059c7e16aee4de6cd4f2f79ed1e0f20ced 100644 (file)
@@ -2,7 +2,7 @@
 // sync_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)
@@ -31,22 +31,21 @@ int main(int argc, char* argv[])
       return 1;
     }
 
-    boost::asio::io_service io_service;
+    boost::asio::io_context io_context;
 
     // Get a list of endpoints corresponding to the SOCKS 4 server name.
-    tcp::resolver resolver(io_service);
-    tcp::resolver::query socks_query(argv[1], argv[2]);
-    tcp::resolver::iterator endpoint_iterator = resolver.resolve(socks_query);
+    tcp::resolver resolver(io_context);
+    tcp::resolver::results_type endpoints = resolver.resolve(argv[1], argv[2]);
 
     // Try each endpoint until we successfully establish a connection to the
     // SOCKS 4 server.
-    tcp::socket socket(io_service);
-    boost::asio::connect(socket, endpoint_iterator);
+    tcp::socket socket(io_context);
+    boost::asio::connect(socket, endpoints);
 
     // Get an endpoint for the Boost website. This will be passed to the SOCKS
     // 4 server. Explicitly specify IPv4 since SOCKS 4 does not support IPv6.
-    tcp::resolver::query http_query(tcp::v4(), "www.boost.org", "http");
-    tcp::endpoint http_endpoint = *resolver.resolve(http_query);
+    tcp::endpoint http_endpoint =
+      *resolver.resolve(tcp::v4(), "www.boost.org", "http").begin();
 
     // Send the request to the SOCKS 4 server.
     socks4::request socks_request(