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