Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

doc/html/boost_asio/example/cpp11/http/server/connection.hpp

Boost , ,

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

doc/html/boost_asio/example/cpp11/http/server/connection.hpp

//
// connection.hpp
// ~~~~~~~~~~~~~~
//
// 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)
//
#ifndef HTTP_CONNECTION_HPP
#define HTTP_CONNECTION_HPP
#include <array>
#include <memory>
#include <boost/asio.hpp>
#include "reply.hpp"
#include "request.hpp"
#include "request_handler.hpp"
#include "request_parser.hpp"
namespace http {
namespace server {
class connection_manager;
/// Represents a single connection from a client.
class connection
  : public std::enable_shared_from_this<connection>
{
public:
  connection(const connection&) = delete;
  connection& operator=(const connection&) = delete;
  /// Construct a connection with the given socket.
  explicit connection(boost::asio::ip::tcp::socket socket,
      connection_manager& manager, request_handler& handler);
  /// Start the first asynchronous operation for the connection.
  void start();
  /// Stop all asynchronous operations associated with the connection.
  void stop();
private:
  /// Perform an asynchronous read operation.
  void do_read();
  /// Perform an asynchronous write operation.
  void do_write();
  /// Socket for the connection.
  boost::asio::ip::tcp::socket socket_;
  /// The manager for this connection.
  connection_manager& connection_manager_;
  /// The handler used to process the incoming request.
  request_handler& request_handler_;
  /// Buffer for incoming data.
  std::array<char, 8192> buffer_;
  /// The incoming request.
  request request_;
  /// The parser for the incoming request.
  request_parser request_parser_;
  /// The reply to be sent back to the client.
  reply reply_;
};
typedef std::shared_ptr<connection> connection_ptr;
} // namespace server
} // namespace http
#endif // HTTP_CONNECTION_HPP

Статья doc/html/boost_asio/example/cpp11/http/server/connection.hpp раздела может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 05:34:16/0.022262096405029/1