UDT Reference: UDT Functions |
The select method queries the status of a group of UDT sockets.
int select(
UDSET *writefds,
const struct timeval *timeout
|
If any of the read/write/exception queries is positive, select returns the number of UDT sockets that are ready; If no socket is ready before timeout, 0 is returned; If there is any error, UDT::ERROR is returned and the specific error information can be retrieved by getlasterror.
Error Code | Comment |
---|---|
5003 |
all the three UDT socket descriptor sets are NULL, or at least one of them contains an invalid socket descriptor. |
The UDSET is a structure to store the UDT socket descriptors. It should be processed with the following macros.
The UDT descriptors sets originally contain the sockets whose status are to be queried. When select returns successfully (returned value is greater than 0), the descriptors sets only contain the sockets that are ready. UD_ISSET is used to query which one is ready.
readfds detects if any socket in this sets is available for reading (recv), for accepting a new connection (accept), or the connection is broken. writefds detects if any socket in this sets has available buffer for sending (send). exceptfds is currently not used.
The following codes show how to send a whole file to the remote node using UDT:
UDTSOCKET u; ...
timeval tv; |