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.
BaseType_t FreeRTOS_closesocket( Socket_t xSocket );
Close a socket.
The function is named FreeRTOS_closesocket() rather than simply
FreeRTOS_close() to avoid potential name space collisions with functions
A socket should be shutdown
gracefully before it is closed, and 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+TCP 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+TCP.
void aFunction( void )
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
if( xSocket != FREERTOS_INVALID_SOCKET )
FreeRTOS_shutdown( xSocket );
while( FreeRTOS_recv( xSocket, pcBufferToTransmit, xTotalLengthToSend, 0 ) >= 0 )
vTaskDelay( pdTICKS_TO_MS( 250 ) );
FreeRTOS_closesocket( xSocket );
Example use of the FreeRTOS_closesocket() API function