geekbrains_network_programming/lesson_04/connection/connection.hpp

33 lines
645 B
C++
Raw Normal View History

2022-09-20 13:37:06 +00:00
/*
* 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);
};
}