[FreeRTOS+TCP API Reference]
BaseType_t FreeRTOS_select( SocketSet_t xSocketSet, TickType_t xBlockTimeTicks );
Block on a “socket set” until an event of interest occurs on a socket within the set. ipconfigSUPPORT_SELECT_FUNCTION must be set to 1 in FreeRTOSIPConfig.h for FreeRTOS_select() (and its associated functions) to be available.
Socket Sets allow an application RTOS task to block on multiple sockets simultaneously.
To use a socket set:
Create a socket set by calling FreeRTOS_CreateSocketSet().
A socket set is equivalent to the Berkeley sockets fd_set type.
Add one or more sockets to the set using calls to FreeRTOS_FD_SET().
FreeRTOS_FD_SET() is equivalent to the Berkeley sockets FD_SET() macro.
Call FreeRTOS_Select() to test the
sockets in the set to see if any of the sockets have an event
- If FreeRTOS_select() returns a non-zero value then check all sockets in the set using a call to FreeRTOS_FD_ISSET() to determine which events are pending.
The FreeRTOS_FD_CLR() API function removes a socket from a set.
The socket set being tested.
The maximum time, in ticks, that the calling RTOS task will
remain in the Blocked state (with other tasks executing)
to wait for a member of the socket set to get an event.
If xBlockTimeTicks expired before a socket in the socket set had an event, then zero is returned. Otherwise a non-zero value is returned. All sockets which belong to the socket set must be checked by calling FreeRTOS_FD_ISSET()
If a socket in the set receives a signal, causing the task that was blocked on the socket to abort its read operation, then the call to FreeRTOS_select() will return -pdFREERTOS_ERRNO_EINTR.