fixed anytun-showtables
[anytun.git] / src / syncServer.h
blobd7317db4b1996c8072350e3a9e8dc85728e30244
1 #ifndef _SYNC_SERVER_H_
2 #define _SYNC_SERVER_H_
3 //#include <iostream>
4 //#include <string>
5 #include <boost/bind.hpp>
6 #include <boost/shared_ptr.hpp>
7 #include <boost/enable_shared_from_this.hpp>
8 #include <boost/function.hpp>
9 #include "threadUtils.hpp"
12 #include <asio.hpp>
13 #include <list>
14 #include "syncTcpConnection.h"
16 //using boost::asio::ip::tcp;
18 class SyncServer
20 public:
21 SyncServer(asio::io_service& io_service, asio::ip::tcp::endpoint tcp_endpoint );
22 boost::function<void(SyncTcpConnection *)> onConnect;
23 std::list<SyncTcpConnection::pointer> conns_;
24 void send(std::string message);
25 private:
26 void start_accept();
27 void handle_accept(SyncTcpConnection::pointer new_connection,
28 const asio::error_code& error);
29 Mutex mutex_; //Mutex for list conns_
30 asio::ip::tcp::acceptor acceptor_;
32 #endif