Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#ifndef CONNECTION_H
|
||||
#define CONNECTION_H
|
||||
|
||||
#include <string>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/signal_set.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "protocol.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
class connection : private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
connection(boost::asio::io_service& ioService, const context& context);
|
||||
|
||||
boost::asio::ip::tcp::socket& socket();
|
||||
|
||||
void start();
|
||||
|
||||
private:
|
||||
void start_read();
|
||||
void handle_read(const boost::system::error_code& ec, std::size_t length);
|
||||
void start_write(const std::string& message);
|
||||
void handle_write(const boost::system::error_code& ec);
|
||||
|
||||
boost::asio::io_service& m_ioService;
|
||||
boost::asio::ip::tcp::socket m_socket;
|
||||
boost::array<char, 1024> m_data;
|
||||
|
||||
protocol m_protocol;
|
||||
};
|
||||
|
||||
#endif // CONNECTION_H
|
||||
|
||||
Reference in New Issue
Block a user