SPMA080 April   2021 TM4C1292NCPDT , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD

 

  1.   Trademarks
  2. Introduction
    1. 1.1 TI-RTOS Download
    2. 1.2 License
    3. 1.3 XDCtools
    4. 1.4 Versions
    5. 1.5 Configuring NDK Modules
    6. 1.6 Socket-Based API
      1. 1.6.1 BSD Style Socket APIs
  3. Application Examples
  4. Application Setup
    1. 3.1 Hardware Setup
    2. 3.2 Software Tools
  5. Download and Import the Ethernet Examples
  6. How to Create an Ethernet Application for TI-RTOS NDK
  7. Enet_tcpecho_server_tirtos Example Overview
    1. 6.1 Build and Flash the Program
    2. 6.2 Check and Program the MAC Address
      1. 6.2.1 Using The LM Flash Programmer
      2. 6.2.2 Using CCS
      3. 6.2.3 Using UniFlash
    3. 6.3 Run the enet_tcpecho_server_tirtos Example
  8. Enet_udpecho_server_tirtos Example Overview
    1. 7.1 Run the enet_udpecho_server_tirtos Example
  9. Enet_httpServer_tirtos Example Overview
    1. 8.1 Configure NDK for HTTP Application
    2. 8.2 Embedded File System (EFS) Operation
    3. 8.3 Adding HTTP Server Content
    4. 8.4 Declaring HTML Files to EFS
    5. 8.5 Writing CGI Functions
    6. 8.6 Run the enet_httpServer_tirtos Example
  10. Enet_dns_tirtos Example Overview
    1. 9.1 How to Configure NDK for DNS
    2. 9.2 How to View the DNS Traffic on Wireshark
    3. 9.3 Run the enet_dns_tirtos Example
  11. 10Enet_sntp_tirtos Example Overview
    1. 10.1 Run the enet_dns_tirtos Example
  12. 11Enet_tcpecho_client_tirtos Example Overview
    1. 11.1 Configure the Server IP Address
    2. 11.2 Configure the SocketTest Server
    3. 11.3 Run the enet_tcpecho_client_tirtos Example
  13. 12Enet_udpecho_client_tirtos Example Overview
    1. 12.1 Run the enet_udpecho_client_tirtos Example
  14. 13Enet_httpget_tirtos Example Overview
    1. 13.1 How to Configure NDK for HTTP GET Example
    2. 13.2 Run the enet_httpget_tirtos Example
  15. 14References

Run the enet_tcpecho_server_tirtos Example

Connect the EK-TM4C1294XL LaunchPad to either the Ethernet switch or the router with an Ethernet cable as shown in Figure 3-1. Run the example. With the CCS console window opened, you should see the IP address (pointed by arrow) displayed and the server is ready as shown in Figure 6-5. Record the IP address as you will need this information on the client side. Initially the server will be in a listening state waiting for the client to connect to it. Therefore, to continue the rest of the example, a remote client needs to be setup.

GUID-20210329-CA0I-3LJC-SZG7-RTXHXMWPLG1B-low.jpg Figure 6-5 Enet_tcpecho_server_tirtos Output

Use the SocketTest tool that will act as the client running on the PC. Make sure the PC is connected to the same network as the EK-TM4C1294XL with the same subnet mask.

Follow the steps shown in Figure 6-6 to setup the client:

  1. Open SocketTest and enter the server IP address as well as the port number 23. Port 23 is the default Telnet port number in TCP and UDP protocols. Finally, press the “Connect” button. In a short while the connection with the server will be established and you are ready for a conversation with the server.
  2. Go to the “Message” field and type in some messages and then hit the “Send” button.
  3. The message you enter will be displayed in the conversation field. When the server receives the message, it will echo back the message to the client.
GUID-20210329-CA0I-KF9L-CKPV-BN6HQS4H7KWG-low.jpg Figure 6-6 SocketTest Client Configuration for Enet_tcpecho_server_tirtos

Examine the message “This is a TCP Echo Server example for TI-RTOS NDK” that was sent by the client to the server. If you count manually, this message has a total length of 51 bytes including the two \n\r escape characters. The \n is the New Line and \r is the Carriage Return character in the ASCII table.

As can be seen in the conversation field, the server echoes back the exact message.

Also, examine the Wireshark capture in Figure 6-7 for the Ethernet traffic.

  1. The client (IP Address 192.168.254.69) sends the message to the server (IP Address 192.168.254.92). For more information, see Figure 6-5 on the IP Address acquired for the server.
  2. The server (IP Address 192.168.254.92) echoes back the message to the client (IP Address 192.168.254.69).
  3. In Wireshark when you click on any row, it will expand with transaction details. Click the frame number 10938 to show the detail pertaining to the echoed message.
  4. As you can see the length of the echoed message by the server is indeed 51 which is the same as what was sent by the client.
  5. The message content echoed by the server is displayed including the two \r\n escape characters.
GUID-20210329-CA0I-VHPK-LSV3-C6KKSM12GRTF-low.jpg Figure 6-7 Server to Client Wireshark Capture for Enet_tcpecho_server_tirtos