You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
685 B

#ifndef TCP_SERVER_HPP
#define TCP_SERVER_HPP
#include "Socket.hpp"
#include "Poll.hpp"
#include <string>
class TcpServer : public Socket
, public Poll
{
public:
TcpServer ( const std::string host,
const std::string port,
const int maxClients = 5 );
virtual ~TcpServer();
bool start();
void stop();
// implements Poll::receive
bool receive( const int fd );
virtual void msgArrived(const int clientSocket,
const std::string msg) = 0;
private:
TcpServer(const TcpServer&);
TcpServer& operator=(const TcpServer&);
std::string m_host;
std::string m_port;
};
#endif // TCP_SERVER_HPP