Daytime.4 소스 (Source listing for Daytime.4) // // client.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2020 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 #include #include using boost::asio::ip::udp; int main(int argc, char* ar..
Daytime.4 - 동기식 UDP daytime 클라이언트 (A synchronous UDP daytime client) 이 튜토리얼 프로그램은 asio를 사용하여 UDP용 클라이언트 응용프로그램을 구현하는 방법을 보여준다. #include #include #include using boost::asio::ip::udp; 응용프로그램의 시작은 TCP daytime 클라이언트와 기본적으로 동일하다. int main(int argc, char* argv[]) { try { if (argc != 2) { std::cerr
Daytime.3 소스 (Source listing for Daytime.3) // // server.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2020 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 #include #include #include #include #include #include using boost::asio::..
Daytime.3 - 비동기식 TCP daytime 서버 (An asynchronous TCP daytime server) main() 함수 int main() { try { 들어오는 클라이언트 연결을 승인하려면 서버 개체를 생성해야 한다. io_context 개체는 서버 개체가 사용할 소켓과 같은 I/O 서비스를 제공한다. boost::asio::io_context io_context; tcp_server server(io_context); io_context 개체를 실행하여 사용자를 대신하여 비동기 작업을 수행한다. io_context.run(); } catch (std::exception& e) { std::cerr start(); } start_accept(); } tcp_connection 클래..
Daytime.2 소스 (Source listing for Daytime.2) // // server.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2020 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 #include #include #include using boost::asio::ip::tcp; std::string make_d..