27 lines
469 B
C++
27 lines
469 B
C++
|
|
#ifndef SERVICE_HPP_QWERTY
|
|
#define SERVICE_HPP_QWERTY
|
|
|
|
#include <expected>
|
|
#include <string>
|
|
|
|
class SocketHandler {
|
|
public:
|
|
virtual void Handle(int sock);
|
|
virtual ~SocketHandler(void);
|
|
};
|
|
|
|
class Service {
|
|
private:
|
|
int port;
|
|
int sock;
|
|
public:
|
|
explicit Service(int port);
|
|
std::expected<void, std::string> Bind(void);
|
|
std::expected<void, std::string> Listen(SocketHandler *handler);
|
|
~Service();
|
|
};
|
|
|
|
#endif
|
|
|