Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services Contact / Enquiries


[FreeRTOS Embedded IP Stack API]

xSocketSet_t FreeRTOS_CreateSocketSet( unsigned BaseType_t uxEventQueueLength );

Create a socket set for use with the FreeRTOS_select() function.

Socket Sets allow an application task to block when reading from multiple sockets at the same time. Instead of blocking on an individual socket, a task instead blocks on the set.

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 contain data that is waiting to be read.

  4. Read from the socket returned by FreeRTOS_select() (if any) using a call to FreeRTOS_recvfrom() as normal.
A socket can only be a member of one set at any time.

FreeRTOS_FD_CLR() removes a socket from a set.


uxEventQueueLength   A receive event is generated each time a socket in the socket set receives data. uxEventQueueLength sets the maximum number of receive events that can be stored by the socket set at any one time.

If a packet is received by a socket that is a member of a socket set, and the socket set's event queue is full, then the packet will be dropped.


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.

[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.