Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Updated Apr 2025

FreeRTOS_CreateSocketSet()

[FreeRTOS-Plus-TCP API Reference]

FreeRTOS_sockets.h

1SocketSet_t FreeRTOS_CreateSocketSet( void );

Create a socket set for use with the FreeRTOS_select() function. ipconfigSUPPORT_SELECT_FUNCTION must be set to 1 in FreeRTOSIPConfig.h for FreeRTOS_CreateSocketSet() to be available.

Socket Sets allow an application RTOS task to block on multiple sockets simultaneously.

To use a socket set:

  1. Create a socket set by calling FreeRTOS_CreateSocketSet().

    A socket set is equivalent to the Berkeley sockets fd_set type.

  2. 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.

  3. Call FreeRTOS_Select() to test the sockets in the set to see if any of the sockets have an event pending.

  4. 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 is used to remove a socket from a socket set.

Returns:

If the socket set was created then a handle to the created socket set is returned. If the socket set was not created (because there was insufficient FreeRTOS heap memory available) then NULL is returned.

Example usage:

See the example on the FreeRTOS_select() documentation page.