|FreeRTOS+UDP was removed from the FreeRTOS kernel download from FreeRTOS V10.1.0. See the FreeRTOS+TCP stack, which can be configured for UDP only use, as an alternative.|
[FreeRTOS Embedded IP Stack API]
BaseType_t FreeRTOS_closesocket( xSocket_t xSocket );
Close a socket.
The function is named FreeRTOS_closesocket() rather than simply FreeRTOS_close() to avoid potential name space collisions with functions in FreeRTOS+IO.
A socket cannot be used after it has been closed.
The handle of the socket being closed. The socket
must have already been created (see
and cannot be used after it has been closed.
0 is always returned.
Although FreeRTOS+UDP does not [currently] use the return value in a meaningful way, the return value is included in the function prototype to ensure consistency with the expected standard Berkeley sockets API, and to ensure compatibility with future versions of FreeRTOS+UDP.
/* FreeRTOS+UDP sockets include */
void aFunction( void )
/* Create a socket. */
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
if( xSocket != FREERTOS_INVALID_SOCKET )
* The socket can now be used…
/* Close the socket again. */
FreeRTOS_closesocket( xSocket );