tcpecho

Example Summary

This application demonstrates how to use TCP.

Peripherals & Pin Assignments

BoosterPacks, Board Resources & Jumper Settings

For board specific jumper settings, resources and BoosterPack modifications, refer to the Board.html file.

If you’re using an IDE such as Code Composer Studio (CCS) or IAR, please refer to Board.html in your project directory for resources used and board-specific jumper settings.

The Board.html can also be found in your SDK installation:

    <SDK_INSTALL_DIR>/source/ti/boards/<BOARD>

Python 3.X is required for this example. To install python download the latest version at https://www.python.org/downloads/release

Example Usage

<SDK_INSTALL_DIR>/tools/examples/tcpSendReceive.py

Usage:

python tcpSendReceive.py <IP-addr> <port> <id> -l[length] -s[sleep in mS] -n[number of transmits per report]

  <IP-addr>     is the IP address of the device
  <port>        is the TCP port being listened to (1000)
  <id>          is a unique id for the executable. Printed out with a packet transmission report.
                It allows the user to run multiple instances of tcpSendReceive.


  Optional:
    -l[length]      size of the packet in bytes. Default is 1024 bytes.
    -s[sleep in mS] usleep time to between sends. Default is 0 mSecs.
    -n[number of transmits per report] the number of transmits to occur before being reported onto the console. Default is 100 transmits.

Example: python tcpSendReceive.py 192.168.1.100 1000 1 -s100

Application Design Details

  1. tcpHandler - Creates a socket and accepts incoming connections. When a connection is established a tcpWorker task is dynamically created to send or receive data.
  2. tcpWorker - Echoes TCP packets back to the client.

tcpHandler performs the following actions:

tcpWorker performs the following actions: