35 lines
768 B
C++
35 lines
768 B
C++
#ifndef SERVER_H
|
|
#define SERVER_H
|
|
|
|
#include <string>
|
|
#include <boost/asio/io_service.hpp>
|
|
#include <boost/asio/ip/tcp.hpp>
|
|
#include <boost/asio/signal_set.hpp>
|
|
#include <boost/shared_ptr.hpp>
|
|
#include "connection.h"
|
|
#include "util.h"
|
|
|
|
|
|
class server
|
|
{
|
|
public:
|
|
server(boost::asio::io_service& ioService, unsigned short port, const std::string& path, const std::string& url);
|
|
|
|
private:
|
|
void start_signal_wait();
|
|
void handle_signal_wait();
|
|
void start_accept();
|
|
void handle_accept(const boost::system::error_code& ec);
|
|
|
|
boost::asio::io_service& m_ioService;
|
|
boost::asio::signal_set m_signal;
|
|
boost::asio::ip::tcp::acceptor m_acceptor;
|
|
boost::asio::ip::tcp::socket m_socket;
|
|
boost::shared_ptr<connection> m_connection;
|
|
|
|
context m_context;
|
|
};
|
|
|
|
#endif // SERVER_H
|
|
|