]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/example/cpp11/http/server/main.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp11 / http / server / main.cpp
1 //
2 // main.cpp
3 // ~~~~~~~~
4 //
5 // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10
11 #include <iostream>
12 #include <string>
13 #include <boost/asio.hpp>
14 #include "server.hpp"
15
16 int main(int argc, char* argv[])
17 {
18 try
19 {
20 // Check command line arguments.
21 if (argc != 4)
22 {
23 std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
24 std::cerr << " For IPv4, try:\n";
25 std::cerr << " receiver 0.0.0.0 80 .\n";
26 std::cerr << " For IPv6, try:\n";
27 std::cerr << " receiver 0::0 80 .\n";
28 return 1;
29 }
30
31 // Initialise the server.
32 http::server::server s(argv[1], argv[2], argv[3]);
33
34 // Run the server until stopped.
35 s.run();
36 }
37 catch (std::exception& e)
38 {
39 std::cerr << "exception: " << e.what() << "\n";
40 }
41
42 return 0;
43 }