]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/example/cpp03/http/server3/main.cpp
5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
13 #include <boost/asio.hpp>
14 #include <boost/bind.hpp>
15 #include <boost/lexical_cast.hpp>
18 int main(int argc
, char* argv
[])
22 // Check command line arguments.
25 std::cerr
<< "Usage: http_server <address> <port> <threads> <doc_root>\n";
26 std::cerr
<< " For IPv4, try:\n";
27 std::cerr
<< " receiver 0.0.0.0 80 1 .\n";
28 std::cerr
<< " For IPv6, try:\n";
29 std::cerr
<< " receiver 0::0 80 1 .\n";
33 // Initialise the server.
34 std::size_t num_threads
= boost::lexical_cast
<std::size_t>(argv
[3]);
35 http::server3::server
s(argv
[1], argv
[2], argv
[4], num_threads
);
37 // Run the server until stopped.
40 catch (std::exception
& e
)
42 std::cerr
<< "exception: " << e
.what() << "\n";