Presented by Jeanna Matthews, 11/13/01

This page written by Jared Hollenbeck

Overview / Background

Test TCP (TTCP) is a command-line sockets-based benchmarking tool for measuring TCP and UDP performance between two systems. It was originally developed for the BSD operating system starting in 1984. The original TTCP and sources are in the public domain, and copies are available from many anonymous FTP sites.

TTCP has become another standard UNIX networking tool because it has a real advantage over tools like FTP. If you have a high performance network, it is difficult for any single computer system to transfer data to or from disk at rates which are sufficient for real network testing. TTCP achieves high performance by filling a memory buffer with data, then repeatedly transmitting this data. Since everything is running from memory, you have a traffic transmitter and receiver that can operate at true network speeds.


Basics of Using TTCP

To use TTCP, you start a copy of TTCP in receive mode at one place within the network, then start a second copy in transmit mode at another place within the network. The results of the transfer of data from the transmitter to the receiver indicate the approximate performance of the path between the source and destination. By selecting the source and destination at various points with the network, you can analyze critical portions of the path.

TCP is a connection oriented protocol, so we must have a receiver listening before a transmitter can connect. So the first step is to start up a TTCP receiver (or use the discard port on a destination system.)
For this demo, we are using the Windows version of ttcp called pcattcp:

Begin by starting a reciever on the destination machine:
pcattcp -r

Use ipconfig to note the IP address of the receiving machine:

ipconfig /all

Then the start the transmitter on the source machine:
pcattcp -t IP_Address_of_receiver

When the connection is made, the receiver outputs a status line showing that it has accepted the connection. Upon completion of the transfer, the receiver statistics are output, showing the amount of data transferred, the transfer time, the calculated throughput, and the number of I/O calls to read the data.

TTCP uses the time and the amount of data transferred, to calculate the throughput between the transmitter and the receiver.

Help Screen:

C:\Program Files\ITL\pcattcp>pcattcp
PCAUSA Test TCP Utility V1.00.00.02
Usage: pcattcp -t [-options] host [ < in ]
       pcattcp -r [-options > out]
Common options:
        -l ##   length of bufs read from or written to network (default 8192)
        -u      use UDP instead of TCP
        -p ##   port number to send to or listen at (default 5001)
        -s      -t: source a pattern to network
                -r: sink (discard) all data from network
        -A      align the start of buffers to this modulus (default 16384)
        -O      start buffers at this offset from the modulus (default 0)
        -v      verbose: print more statistics
        -d      set SO_DEBUG socket option
        -b ##   set socket buffer size (if supported)
        -f X    format for rate: k,K = kilo{bit,byte}; m,M = mega; g,G = giga
Options specific to -t:
        -n ##   number of source bufs written to network (default 2048)
        -D      don't buffer TCP writes (sets TCP_NODELAY socket option)
Options specific to -r:
        -B      for -s, only output full blocks as specified by -l (for TAR)
        -T      "touch": access each byte as it's read

Typical Transmitting Screen:

C:\Program Files\ITL\pcattcp>pcattcp -u -t
PCAUSA Test TCP Utility V1.00.00.02
TTCP Transmit Test
  Protocol   : UDP
  Port       : 5001
pcattcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  udp -> 128.153.140
pcattcp-t: socket
pcattcp-t: 16777216 bytes in 1.93 real seconds = 8480.33 KB/sec +++
numCalls: 2054; msec/call: 0.96; calls/sec: 1063.15


By default, a TCP connection is used to transmit the data. You can use UDP instead by using a "-u" flag on both the sender and the receiver:
On receiver: pcattcp -r -u

On transmitter: pcattcp -u -t dest_machine

Performance Comparison

You can also vary the size of the packets sent over the network with the -l flag. We used this to compare TCP throughput to UDP throughput and how each of them is effected by changes in packet size.

For example, the following line will transmit 512 bytes at a time over a UDP connection:
On receiver: pcattcp -t -u -l 512 IP_address_of_receiver
In this demo, we collected the following data:

Transport Mechanism Packet Size Throughput (KB/s)
TCP 512 97
TCP 1460 119
UDP 512 4096
TCP 8192 165
UDP 8192 9216

This data clearly shows that the overhead of TCP's reliable in-order byte stream with flow control. UDP has (*much* higher throughput! You can also see that larger packet size transltes into lower overhead and higher throughput!

Other Uses

To transfer files, data can be piped into the transmitter and out of the receiver:
On receiver: pcattcp -r | tar xvpf -
On transmitter: tar cf - directory | pcattcp -t dest_machine

pcattcp -r | pcattcp -t next_machine


like TTCP, developed by NLANR. Friendlier and more functionality. See links below.


Here are some useful links: