dsfml.network.selector



class Selector(T);
Selector TCP allow reading from multiple sockets without blocking. It's a kind of multiplexer. Use SocketTCP or SocketUDP aliases.

this();
Default constructor

void add(T socket);
Add a socket to watch

Params:
T socket A tcp or udp socket

void remove(T socket);
Remove a previously added socket

Params:
T socket A tcp or udp socket

void clear();
Clear all sockets being watched

uint wait(float timeout = 0F);
Wait and collect sockets which are ready for reading. This functions will return either when at least one socket is ready, or when the given time is out

Params:
float timeout Maximum time to wait, in seconds (0 to disable timeout)

Returns:
Number of sockets ready

T GetSocketsReady(uint index);
After a call to Wait(), get the Index-th socket which is ready for reading. The total number of sockets ready is the integer returned by the previous call to Wait()

Params:
uint index Index of the socket to get

Returns:
The Index-th socket

alias SelectorTCP;
alias SelectorUDP;
alias of selector for TCP or UDP Socket.


Page generated by Ddoc.