The selectEx method queries a group of of UDT sockets for IO status.
If any of the read, write, or except group is not empty, selectEx returns the number of UDT sockets that are read for read/write or are broken/closed. If no socket is ready before timeout, zero is returned. If there is any error, UDT::ERROR is returned and the specific error information can be retrieved using getlasterror. The readfds,writefds and/or exceptfds will be updated to contain the ready sockets.
Error Name | Error Code | Comment |
EINVPARAM | 5003 | All three socket sets are NULL or at least one of the socket is invalid. |
This function selectEx is an advanced version of select. In contrast to select, selectEx does not modify the input parameter fds, so that applications do not need to replicate or initialize it every time the function is called.
The new function only has one group of input socket descriptors. If a particular event check is not necessary, the corresponding output parameter can be set to NULL. For example, if the application does not care about if a socket is ready for send, the parameter writefds can be NULL.
Finally, selectEx specifies the absolute amount of time to wait, while select requires a clock time in the future to wait until.
Overall, selectEx is more convinient and more efficient.