|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.|
Embedded UDP Echo Client Tasks
Example Demonstrating Both Standard and Zero Copy Send and Receive
TwoEchoClients.cA standard echo server will echo back any data it receives on UDP (or TCP) port 7. Echo clients send data to the server, then listen for the reply.
The C source file TwoEchoClients.c (located in FreeRTOS-Plus/Demo_Files/FreeRTOS_Plus_UDP_Demos/EchoClients) uses FreeRTOS+UDP to implements two echo clients – one that uses the standard Berkeley sockets interface, and one that uses the zero copy sockets interface. Each client sits in a loop that creates a socket, sends 50 echo requests through the socket (waiting for the reply after each request), and then closes the socket. The delay between closing a socket and creating the next socket is set by the echoLOOP_DELAY constant defined in the file itself.
The pre-configured FreeRTOS+UDP demo projects that can be downloaded from this website use the echo client implementation as a simple and convenient introduction to network programming.
A simple transaction between an echo client and an echo server
Setting Up An Echo ServerDesktop operating systems will often include an echo server that, more often than note, is disabled but default. That means the server must be manually started before it can be used. For example, Microsoft Windows XP includes an Echo server in the optional networking component called “Simple TCP/IP Services”. The component can be enabled through either of the “Add/Remove Windows Component” or “Network Connections” Windows dialog boxes (click the link to be taken to the microsoft.com web page that describes how to install optional networking components – the required “Simple TCP/IP Services” component is a sub-component of “Network Services”).
If you are unable or unwilling to use an echo server built into your desktop operating system then you can install a third party tool such as CommEcho.
Note 1: If you opt to use a third party tool then ensure the echo server is configured to listen on port 7.
Note 2: Ensure your network firewall does not block access to the echo server!
Configuring The Demo To Locate The Echo ServerThe IP address of the echo server is set by the constants configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3, which are located in the standard FreeRTOS configuration file FreeRTOSConfig.h.