FreeRTOS+TCP Demo Project
For Windows Simulator
On this page:
This demo application is called available
FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator and is located in the following directory
of the official FreeRTOS zip file download and on Github.
The project uses the
FreeRTOS Windows simulator
The Windows simulator provides a convenient evaluation platform, but it
does not exhibit real time behavior. Simulated time is much slower than
The project is pre-configured to build with the
free Express edition of Microsoft Visual C++
(MSVC). MSVC Express Edition 2010 was used.
The demo includes the following standard demo configurations:
Two sets of UDP client and server tasks, where the client task sends
data to the server task. One set of tasks uses the standard sockets
interface. The other set of tasks uses the zero copy sockets interface.
The project can optionally be built to also include:
A simple TCP echo client task, where the task sends data to a server
(address configured using configECHO_SERVER_ADDR[0-3] and echoECHO_PORT)
and waits for the echo reply. The reply is checked for correctness.
A simple TCP echo server task, where the task waits for incoming connections
When a connection is made and data is received, the task responds backs with
the same data.
Download the source code via the FreeRTOS downloads page that contains the source code and project
files. Extract the zip file into a convenient location, ensuring
the directory structure is maintained.
Open the Visual Studio solution file FreeRTOS_Plus_TCP_Minimal.sln
from within the Visual Studio IDE. The solution file is located
in the "FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator"
The demo uses WinPCap to create a virtual network connection by
accessing raw Ethernet data on a real network connection. Many
computers have more than one real network port. Set
configNETWORK_INTERFACE_TO_USE in FreeRTOSConfig.h. to tell the demo which real port
should be used to create the virtual port.
Available port numbers are displayed on the console when the
application is executed (see the image in the Usage Instructions
Follow the instructions provided on the
Echo Client example documentation page
to set up an echo server and set the address of the echo server
in FreeRTOSConfig.h. Alternatively, a TCP echo server and/or
client can be set up by setting the macros mainCREATE_TCP_ECHO_TASKS_SINGLE
and mainCREATE_TCP_ECHO_SERVER_TASK to 1.
The virtual port has its own MAC address.
Set the constants configMAC_ADDR0 to configMAC_ADDR5 to ensure
the MAC address used by the virtual network connection is unique on the network. The constants
are located at the bottom of FreeRTOSConfig.h.
If the IP address assignment is managed by a
then no further configuration is required.
If IP address assignment is not managed by a DHCP server then set
ipconfigUSE_DHCP to 0 in FreeRTOSIPConfig.h,
then edit the constants at the bottom of FreeRTOSConfig.h that
set the default values for a static IP address, DNS server address,
gateway address and netmask to ensure they are valid for the
Ethernet network. The IP address will be valid if the first three
octets of the IP address match the first three octets of other
IP addresses on the same network - each IP address must be unique
on the network.
Select "Build Solution" from the IDE's Build menu (or press F7)
to build the application.
The standard Visual Studio
key used to start a debug session and break on entry to main() is F10.
The same host computer is used to build the application, debug the application,
and (because the Win32 simulator is used) run the application.
There are no special debugging instructions.
The following constants are defined in main.c to allow tasks to
be included or excluded from the build:
#define mainCREATE_SIMPLE_UDP_CLIENT_SERVER_TASKS 1
#define mainCREATE_TCP_ECHO_TASKS_SINGLE 0
#define mainCREATE_TCP_ECHO_SERVER_TASK 0
Old Demos with Other Open Source TCP/IP Stacks
Read further for additional information on legacy TCP/IP demos.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.