0 Members and 1 Guest are viewing this topic.
As a bonus, the timeout capability of Selector::wait allows to implement a receive-with-timeout function, which is not directly available in the socket classes, very easily:sf::Socket::Status receiveWithTimeout(sf::TcpSocket& socket, sf::Packet& packet, sf::Time timeout){ sf::SocketSelector selector; selector.add(socket); if (selector.wait(timeout)) return socket.receive(packet); else return sf::Socket::NotReady;}