Secure Sockets Echo Client Demo
The following example uses a single RTOS task. The source code for this example can
be found at
demos/tcp/aws_tcp_echo_client_single_task.c.
Before you begin, verify that you have downloaded Amazon FreeRTOS to your microcontroller and built and run the Amazon FreeRTOS demo projects. You can download Amazon FreeRTOS from GitHub. For more information about setting up an Amazon FreeRTOS-qualified board, see Getting Started with Amazon FreeRTOS.
To run the demo
Note
The TCP server and client demos are currently not supported on the Cypress CYW943907AEVAL1F and CYW954907AEVAL1F Development Kits.
-
Follow the instructions in Setting Up the TLS Echo Server in the Amazon FreeRTOS Porting Guide.
A TLS echo server should be running and listening on the port 9000.
During the setup, you should have generated four files:
-
client.pem(client certificate) -
client.key(client private key) -
server.pem(server certificate) -
server.key(server private key)
-
-
Use the tool
tools/certificate_configuration/CertificateConfigurator.htmlto copy the client certificate (client.pem) and client private key (client.key) toaws_clientcredential_keys.h. -
Open the
FreeRTOSConfig.hfile. -
Set the
configECHO_SERVER_ADDR0,configECHO_SERVER_ADDR1,configECHO_SERVER_ADDR2, andconfigECHO_SERVER_ADDR3variables to the four integers that make up the IP address where the TLS Echo Server is running. -
Set the
configTCP_ECHO_CLIENT_PORTvariable to9000, the port where the TLS Echo Server is listening. -
Set the
configTCP_ECHO_TASKS_SINGLE_TASK_TLS_ENABLEDvariable to1. -
Use the tool
tools/certificate_configuration/PEMfileToCString.htmlto copy the server certificate (server.pem) tocTlsECHO_SERVER_CERTIFICATE_PEMin the fileaws_tcp_echo_client_single_task.c. -
Open
, comment out<amazon-freertos>/vendors/<vendor>/boards/<board>/aws_demos/config_files/aws_demo_config.h#define CONFIG_MQTT_DEMO_ENABLED, and defineCONFIG_TCP_ECHO_CLIENT_DEMO_ENABLED.
The microcontroller and the TLS Echo Server should be on the same network. When the
demo starts (main.c), you should see
a log message that reads Received correct string from echo server.
