#include #include #include #include "Socket.h" #include "Client.h" #include "Game.h" int main() { Socket socket; if(socket.start(4456)) { return 0; } std::array clients; while(true) { int clientId = socket.waitForClients(100); if(clientId != -1) { for(Client& client : clients) { if(client.isFree()) { client.start(clientId); clientId = -1; std::cout << "client added" << "\n"; break; } } if(clientId != -1) { std::cout << "client disconnected - full server" << "\n"; close(clientId); } } char buffer[256]; if(socket.readConsole(buffer, 256, 100)) { break; } } return 0; }