TCP/IP stack API function is used to receive from a UDP socket.
Data can only be received after the
socket has been
created, configured, and
bound to a local port number.
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.
As detailed on the FreeRTOS_recvfrom() API reference page, FreeRTOS_recvfrom()
can be used with standard calling semantics, or zero copy calling semantics.
This page demonstrates the standard calling semantics.
The source code below shows a RTOS task that creates a socket before entering
a loop that receives data using the standard (as opposed to zero copy)
static void vUDPReceivingUsingStandardInterface( void *pvParameters )
uint8_t cReceivedString[ 60 ];
struct freertos_sockaddr xClient, xBindAddress;
uint32_t xClientLength = sizeof( xClient );
xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET,
configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
xBindAddress.sin_port = FreeRTOS_htons( 10000 );
FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
for( ;; )
lBytes = FreeRTOS_recvfrom( xListeningSocket,
sizeof( cReceivedString ),
if( lBytes > 0 )
Example using FreeRTOS_recvfrom() with the standard (as opposed to zero copy) calling semantics
Back to the RTOS TCP networking tutorial index