void Server::select_manage() { while (42) { setFds(); if (select(maxFd + 1, &fdRead, &fdWrite, NULL, NULL) == -1) throw ("select failed\n"); checkFds(); usleep(100000); } }
void ServerW::launch() { std::cout << "ServerW running on port 4242\nWaiting for clients..." << std::endl; while (1) { setFds(); if (select(_fdMax + 1, &_fdRead, &_fdWrite, NULL, NULL) == -1) throw(std::exception("Select failed")); checkFds(); } }
void AClient::run(std::string const& ip, int const port) { _sIn.sin_family = AF_INET; _sIn.sin_port = htons(port); _sIn.sin_addr.s_addr = inet_addr(ip.c_str()); socket(); if (_clientType == TCP) connect(); while (42) { resetFds(); setFds(); select(); checkFds(); } }