[ ]
 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT Contact / Enquiries


FreeRTOS+TCP is still in the lab
FreeRTOS+TCP is already used in commercial products and we encourage you to try it yourself. Be aware however that we are still refining its design, and the source code and documentation do not yet meet Real Time Engineers Ltd's strict quality standards.
Please use the forum for support, feedback and ideas, or contact us directly if you have a specific business interest.

FreeRTOS_FD_ISSET()

[FreeRTOS+TCP API Reference]

FreeRTOS_sockets.h
BaseType_t FreeRTOS_FD_ISSET( Socket_t xSocket, SocketSet_t xSocketSet );
		

Check if a socket in a socket set has an event bit set. ipconfigSUPPORT_SELECT_FUNCTION must be set to 1 in FreeRTOSIPConfig.h for FreeRTOS_FD_ISSET() 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 event bits of interest are a bitwise OR combination of one or more of the following values:

eSELECT_READ For a socket that is reading data, the eSELECT_READ event will be pending in a socket as long as the socket contains unread data.

For a socket that is listening for new connections, the eSELECT_READ event will be pended each time a new connection is received.

eSELECT_WRITE The eSELECT_WRITE event will remain pending as long as the socket has space for writing.

If a TCP socket is actively connecting to a pear the eSELECT_WRITE event will be triggered as soon as the connection is established.

One the eSELECT_WRITE event has been pended it should either be disabled, or the caller should write enough data to the socket so as to completely fill up the transmit buffer - otherwise the pending eSELECT_WRITE event will not be cleared.

eSELECT_EXCEPT The eSELECT_EXCEPT event will become pending if the socket gets disconnected.

The FreeRTOS_FD_CLR() API functions clears event bits of interest and removes a socket from a set.

Parameters:

xSocket   The socket within the socket set being tested to see if it has any event bits set.

xSocketSet   The socket set to which the socket is being added.

Returns:

The function returns a bit-mask of the values eSELECT_READ (1), eSELECT_WRITE (2) and eSELECT_EXCEPT (4). Only the bits of interest specified using calls to FreeRTOS_FD_SET() will be returned.

Example usage:

See the example on the FreeRTOS_select() documentation page.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.