33 lines
645 B
C++
33 lines
645 B
C++
|
/*
|
|||
|
* connection.hpp
|
|||
|
*
|
|||
|
* Created on: 20 сент. 2022 г.
|
|||
|
* Author: alexander
|
|||
|
*/
|
|||
|
|
|||
|
#pragma once
|
|||
|
|
|||
|
#include <boost/asio.hpp>
|
|||
|
#include <memory>
|
|||
|
|
|||
|
namespace azh
|
|||
|
{
|
|||
|
using boost::asio::ip::tcp;
|
|||
|
|
|||
|
class Connection : public std::enable_shared_from_this<Connection>
|
|||
|
{
|
|||
|
public:
|
|||
|
using pointer = std::shared_ptr<Connection>;
|
|||
|
|
|||
|
static pointer create(boost::asio::io_context& ioContext);
|
|||
|
tcp::socket& socket();
|
|||
|
void start();
|
|||
|
private:
|
|||
|
tcp::socket _socket;
|
|||
|
std::string _message = "Hello, client!\n";
|
|||
|
private:
|
|||
|
explicit Connection(boost::asio::io_context& ioContext);
|
|||
|
};
|
|||
|
|
|||
|
}
|