]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/example/cpp03/iostreams/daytime_server.cpp
5 // Copyright (c) 2003-2017 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)
14 #include <boost/asio.hpp>
16 using boost::asio::ip::tcp
;
18 std::string
make_daytime_string()
20 using namespace std
; // For time_t, time and ctime;
29 boost::asio::io_context io_context
;
31 tcp::endpoint
endpoint(tcp::v4(), 13);
32 tcp::acceptor
acceptor(io_context
, endpoint
);
37 boost::system::error_code ec
;
38 acceptor
.accept(stream
.socket(), ec
);
41 stream
<< make_daytime_string();
45 catch (std::exception
& e
)
47 std::cerr
<< e
.what() << std::endl
;