123456789101112131415161718192021222324252627282930 |
- #ifndef SERVER_H
- #define SERVER_H
- #include <thread>
- #include <atomic>
- #include "server/network/Socket.h"
- #include "server/GameServer.h"
- class Server final {
- public:
- Server(const Socket& connectionListener, u16 maxClients, GameServer& gameServer);
- ~Server();
- Server(const Server& other) = delete;
- Server& operator=(const Server& other) = delete;
- Server(Server&& other) = delete;
- Server& operator=(Server&& other) = delete;
-
- void start();
-
- private:
- void listenForClients() const;
- const Socket& connectionListener;
- GameServer gameServer;
- std::atomic_bool running;
- std::thread listenerThread;
- };
- #endif
|