Client.h 507 B

1234567891011121314151617181920212223242526272829303132
  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
  8. {
  9. public:
  10. Client();
  11. virtual ~Client();
  12. bool start(const string& ip, unsigned short port, IClientListener* listener);
  13. void stop();
  14. private:
  15. void listenOnServer();
  16. int connectionSocket = -1;
  17. volatile bool shouldRun = false;
  18. thread serverListenThread;
  19. IClientListener* clientListener;
  20. };
  21. #endif