Client.h 493 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef CLIENT_H
  2. #define CLIENT_H
  3. #include <string>
  4. #include <thread>
  5. #include "client/network/IClientListener.h"
  6. using namespace std;
  7. class Client final {
  8. public:
  9. Client();
  10. virtual ~Client();
  11. bool start(const string& ip, unsigned short port, IClientListener* listener);
  12. void stop();
  13. private:
  14. void listenOnServer();
  15. int connectionSocket = -1;
  16. volatile bool shouldRun = false;
  17. thread serverListenThread;
  18. IClientListener* clientListener;
  19. };
  20. #endif