summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/src/examples/cpp03/iostreams
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/src/examples/cpp03/iostreams')
-rw-r--r--3rdparty/asio/src/examples/cpp03/iostreams/.gitignore11
-rw-r--r--3rdparty/asio/src/examples/cpp03/iostreams/daytime_client.cpp44
-rw-r--r--3rdparty/asio/src/examples/cpp03/iostreams/daytime_server.cpp51
-rw-r--r--3rdparty/asio/src/examples/cpp03/iostreams/http_client.cpp91
4 files changed, 0 insertions, 197 deletions
diff --git a/3rdparty/asio/src/examples/cpp03/iostreams/.gitignore b/3rdparty/asio/src/examples/cpp03/iostreams/.gitignore
deleted file mode 100644
index bc2b4f8f7fe..00000000000
--- a/3rdparty/asio/src/examples/cpp03/iostreams/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-.dirstamp
-*.o
-*.obj
-*.exe
-*_client
-*_server
-*.ilk
-*.manifest
-*.pdb
-*.tds
diff --git a/3rdparty/asio/src/examples/cpp03/iostreams/daytime_client.cpp b/3rdparty/asio/src/examples/cpp03/iostreams/daytime_client.cpp
deleted file mode 100644
index 4d0f68ca989..00000000000
--- a/3rdparty/asio/src/examples/cpp03/iostreams/daytime_client.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// daytime_client.cpp
-// ~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2016 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 <iostream>
-#include <string>
-#include <asio.hpp>
-
-using asio::ip::tcp;
-
-int main(int argc, char* argv[])
-{
- try
- {
- if (argc != 2)
- {
- std::cerr << "Usage: daytime_client <host>" << std::endl;
- return 1;
- }
-
- tcp::iostream s(argv[1], "daytime");
- if (!s)
- {
- std::cout << "Unable to connect: " << s.error().message() << std::endl;
- return 1;
- }
-
- std::string line;
- std::getline(s, line);
- std::cout << line << std::endl;
- }
- catch (std::exception& e)
- {
- std::cout << "Exception: " << e.what() << std::endl;
- }
-
- return 0;
-}
diff --git a/3rdparty/asio/src/examples/cpp03/iostreams/daytime_server.cpp b/3rdparty/asio/src/examples/cpp03/iostreams/daytime_server.cpp
deleted file mode 100644
index ed3f94b0505..00000000000
--- a/3rdparty/asio/src/examples/cpp03/iostreams/daytime_server.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// daytime_server.cpp
-// ~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2016 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 <ctime>
-#include <iostream>
-#include <string>
-#include <asio.hpp>
-
-using asio::ip::tcp;
-
-std::string make_daytime_string()
-{
- using namespace std; // For time_t, time and ctime;
- time_t now = time(0);
- return ctime(&now);
-}
-
-int main()
-{
- try
- {
- asio::io_context io_context;
-
- tcp::endpoint endpoint(tcp::v4(), 13);
- tcp::acceptor acceptor(io_context, endpoint);
-
- for (;;)
- {
- tcp::iostream stream;
- asio::error_code ec;
- acceptor.accept(stream.socket(), ec);
- if (!ec)
- {
- stream << make_daytime_string();
- }
- }
- }
- catch (std::exception& e)
- {
- std::cerr << e.what() << std::endl;
- }
-
- return 0;
-}
diff --git a/3rdparty/asio/src/examples/cpp03/iostreams/http_client.cpp b/3rdparty/asio/src/examples/cpp03/iostreams/http_client.cpp
deleted file mode 100644
index 247df0f37e4..00000000000
--- a/3rdparty/asio/src/examples/cpp03/iostreams/http_client.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// http_client.cpp
-// ~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2016 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 <iostream>
-#include <istream>
-#include <ostream>
-#include <string>
-#include <asio/ip/tcp.hpp>
-
-using asio::ip::tcp;
-
-int main(int argc, char* argv[])
-{
- try
- {
- if (argc != 3)
- {
- std::cout << "Usage: http_client <server> <path>\n";
- std::cout << "Example:\n";
- std::cout << " http_client www.boost.org /LICENSE_1_0.txt\n";
- return 1;
- }
-
- asio::ip::tcp::iostream s;
-
- // 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));
-
- // Establish a connection to the server.
- s.connect(argv[1], "http");
- if (!s)
- {
- std::cout << "Unable to connect: " << s.error().message() << "\n";
- return 1;
- }
-
- // Send the request. We specify the "Connection: close" header so that the
- // server will close the socket after transmitting the response. This will
- // allow us to treat all data up until the EOF as the content.
- s << "GET " << argv[2] << " HTTP/1.0\r\n";
- s << "Host: " << argv[1] << "\r\n";
- s << "Accept: */*\r\n";
- s << "Connection: close\r\n\r\n";
-
- // By default, the stream is tied with itself. This means that the stream
- // automatically flush the buffered output before attempting a read. It is
- // not necessary not explicitly flush the stream at this point.
-
- // Check that response is OK.
- std::string http_version;
- s >> http_version;
- unsigned int status_code;
- s >> status_code;
- std::string status_message;
- std::getline(s, status_message);
- if (!s || http_version.substr(0, 5) != "HTTP/")
- {
- std::cout << "Invalid response\n";
- return 1;
- }
- if (status_code != 200)
- {
- std::cout << "Response returned with status code " << status_code << "\n";
- return 1;
- }
-
- // Process the response headers, which are terminated by a blank line.
- std::string header;
- while (std::getline(s, header) && header != "\r")
- std::cout << header << "\n";
- std::cout << "\n";
-
- // Write the remaining data to output.
- std::cout << s.rdbuf();
- }
- catch (std::exception& e)
- {
- std::cout << "Exception: " << e.what() << "\n";
- }
-
- return 0;
-}