blob: 47c505608c012b352d0641a9bb196a0c70f22534 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <boost/asio.hpp>
#include <boost/function.hpp>
#include "connection.h"
class TCPServer {
private:
boost::asio::ip::tcp::acceptor acceptor_;
boost::function<void (Connection::p)> connect_callback;
//! Listen for incoming connection.
void listen();
//! Handle new connection.
void handle_connection(Connection::p connection, const boost::system::error_code& error);
public:
TCPServer(boost::asio::io_service& io_service);
void get_connection(boost::function<void (Connection::p)> f);
};
#endif
|