Advertisement
Guest User

Server.h

a guest
Jul 5th, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #ifndef SERVER_H
  2. #define SERVER_H
  3.  
  4. #include <iostream>
  5. #include <boost/asio.hpp>
  6. #include <boost/bind.hpp>
  7. #include <boost/bind/placeholders.hpp>
  8. #include "Connection.h"
  9. #include <string>
  10. #include <vector>
  11.  
  12.  
  13. class Server{
  14.     tcp::acceptor accept;
  15.     boost::asio::io_service io_service;
  16.     std::vector<Connection::pointer> connections;
  17.  
  18. public:
  19.     Server(boost::asio::io_service& io_service, int port=23);
  20.     Server(int port = 23);
  21.     void msgHandler(std::string msg);
  22.  
  23. private:
  24.     void waitForConnection();
  25.     void acceptConnection(Connection::pointer connection, const boost::system::error_code& error);
  26.  
  27. };
  28.  
  29.  
  30. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement