Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services Contact / Enquiries

Embedded UDP Echo Client Tasks
Example Demonstrating Both Standard and Zero Copy Send and Receive


A 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.

embedded echo clients communicating with a standard echo server
A simple transaction between an echo client and an echo server

Setting Up An Echo Server

Desktop 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 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 Server

The 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.

Video Demonstration

[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ 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.