The SocketTest tool 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 7-1 to setup the SocketTest:
- Go to the “Udp” tab.
- Enter the PC’s IP address and the port number 23 and press the “Start Listening” button. The server IP address should be the address of the PC running SocketTest. To find out the PC’s IP address in your network, you can use the Windows’ ipconfig command. Bring up a Windows command window and at the prompt type “ipconfig” and you will see the IP address assigned to your PC. Note in SocketTest, the Server address field will be the address of the PC regardless if the PC is the actual server or client. SocketTest just listens for any incoming data at the specified address.
- Enter the MCU’s IP address in the “IP Address for Client”. The IP address assigned to the MCU is shown in the CCS console window.
- Go to the “Message” field and type in some messages and then hit the “Send” button.
- Observe the conversation field in SocketTest.
Examine the Wireshark capture for the UDP traffic in Figure 7-2.
- The frame number 15351 is the first echoed message from the server (IP Address 192.168.254.92) to the client (IP Address 192.168.254.69).
- The length is 49 bytes which is not surprising if we were to count the message “This is a UDP Echo Server example for TI-RTOS NDK\n\r” manually. Also, look at the port numbers. The port number on the PC (the client) is 60766 while the port number on the MCU (the server) is 23. The 60766 is different from what was entered in Figure 7-2. The reason is that the client never explicitly chooses a UDP port to bind to. The stack on the client side simply picks a current-available UDP port to implicitly bind the sending UDP socket to and this port may be different each time. However, the NDK stack running on the MCU is configured to bind to port 23.