26 #pragma warning(disable : 4127) // "conditional expression is constant" generated by the FD_SET macro 32 #include <SFML/Network/SelectorBase.hpp> 52 FD_SET(Socket, &mySet);
54 int Size =
static_cast<int>(Socket);
55 if (Size > myMaxSocket)
65 FD_CLR(Socket, &mySet);
90 Time.tv_sec =
static_cast<long>(Timeout);
91 Time.tv_usec = (
static_cast<long>(Timeout * 1000) % 1000) * 1000;
97 int NbSockets = select(myMaxSocket + 1, &mySetReady, NULL, NULL, Timeout > 0 ? &Time : NULL);
99 return NbSockets >= 0 ?
static_cast<unsigned int>(NbSockets) : 0;
112 for (
int i = 0; i < myMaxSocket + 1; ++i)
114 if (FD_ISSET(i, &mySetReady))
123 return static_cast<SocketHelper::SocketType
>(i);
unsigned int Wait(float Timeout=0.f)
Wait and collect sockets which are ready for reading.
void Remove(SocketHelper::SocketType Socket)
Remove a socket.
void Add(SocketHelper::SocketType Socket)
Add a socket to watch.
SelectorBase()
Default constructor.
void Clear()
Remove all sockets.
static SocketType InvalidSocket()
Return the value of the invalid socket.
SocketHelper::SocketType GetSocketReady(unsigned int Index)
After a call to Wait(), get the Index-th socket which is ready for reading.