		TCPBLAST - NETWORK BANDWIDTH MEASURING TOOL

Tcpblast can be used for:
- crude network throuput measurements
- testing bandwidth limits (also in incoming direction or bidirectional)

Tcpblast typically will need one of the discard, echo or chargen services which
are usually turned off because of security reasons.

WARNING: tcpblast makes really crude measurements of the throuput by sending as
much data as possible. USE CAREFULLY. For much more subtle bandwidth
measurements use tools 
http://www.employees.org/~bmah/Software/pchar/	by Bruce A. Mah
http://www.cs.colby.edu/~downey/clink/		by Allen B. Downey
ftp://ftp.ee.lbl.gov/pathchar/			by Van Jacobson


		PATHCHAR-STYLE TOOLS AND TCPBLAST COMPARISON

Pro tcpblast:
- gives immediate results
- clogs the link - good for testing actual bandwidth limits (like CBQ+TBF)
- bidirectional
- can generate traffic with specific limit for specified time

Contra:
- needs discard or echo service
- wastes bandwidth
- bottleneck measurement only
- cannot measure raw capacity on loaded link


		COUSINS

New version of tcpblast is based on (or ideas contained in) tcpblast, tcpping,
tcpspray and ttcp, various versions floating around, mostly on FreeBSD version
of tcpblast (signed: Daniel Karrenberg <dfk@nic.eu.net>, but I do not think we
should bother him with bugs of this version).


		INSTALLATION

Tcpblast can be made as follows:

./configure
make
make install

The standalone discard program is not installed by default.


		RECENT VERSION

The newest version is available in
ftp://ftp.icm.edu.pl/pub/software/blast/


The discussion list has been discontinued.


		OPTIONS

Usage: tcpblast [options] destination[:port]

tcpblast/udpblast is a simple tool for probing network and estimating its
throughput. By default it sends 300 blocks (1024 bytes each) of data to
specified destination host.

Options:
-a               send random data
-b BUF_SIZE      socket buf size (default: -1 == don't change), with `-' to be
                   substracted from results
-c BLOCKS        change default (300) number of blocks, range: 1..10000000
-d DOTFREQ       print dot every DOTFREQ blocks, disables cont. speed disp.
-h, --help       this help
-i, --delay DELAY  write delay in microseconds (EXPERIMENTAL)
-l, --last BLKS  show also speed for last BLKS blocks
    --nwrite     do not write, use e.g. with chargen port
-m               results for every block in separate line
-o               turn off default continuous speed displaying
-p PORT          bind this local PORT
-q --quiet       show only final statistics
-r, --read       read data returned to us, switches default port to echo
-R, --rate RATESPEC  limit the speed according to the RATESPEC
-s BLOCK_SIZE    block size (default 1024 bytes)
-t MAXTIME       limit time to MAXTIME s (up to 42950 h)
    --tcp        use TCP (default)
    --udp        use UDP (default if named udpblast)
-v, --verbosity  verbosity, default 0, maximum 3. -v adds time display, -vv also speed
                   in B/s, -v - speed in b/s.
-V, --version    version
destination      host name or address
port             use port #/name xyz instead of default port 9

RATESPEC         RATE[,TIME][:RATE[,TIME]]...
RATE             generating data at RATE speed in B/s
TIME             for TIME seconds (can be floating point number), last can
                   be omitted and that time will be infinite

Options -b, -c and -R can use case insensitive unit multipliers and
specifiers:
  -b without units is in bytes, can use [{k,m,g}]b (lower or upper case)
     for KB, MB or GB. {k,m,g} are powers of 1024.
  -c argument is just a number, can have k, m or g added (powers of 1024),
     no unit needed
  -R RATE is in B/s or Bps, the postfixes can be [{k,m,g}]{b/s,bps}
  -R TIME is in seconds, can be posfixed with [{k,m,g}]{s,min,h,w,m,y}
Example:
  tcpblast -b 4KB -c 10k -R 10kbps,2:20kbps,3s target

tcpblast version: FreeBSD + rzm 20001017


		EXAMPLES

tcpblast -c 200 step

read SO_SNDBUF = 65535
Sending non-random TCP data to step:9 using 1024 B blocks.
Written   200 KB   35.10 KB/s


tcpblast -r -c 200 --nwrite step:chargen

read SO_SNDBUF = 65535
Sending non-random TCP data to step:chargen using 1024 B blocks.
/Read /200 KB   /9.65 KB/s


tcpblast -r -c 200 step:echo

read SO_SNDBUF = 65535
Sending non-random TCP data to step:echo using 1024 B blocks.
Written/Read   200/200 KB   16.98/16.94 KB/s


But:

tcpblast step:chargen

blocks after some time because chargen is not reading anything, we can fill the
buffers and that is all. Such command can be stopped by ^C or using a time
limit:

tcpblast -t 10 step:chargen


With UDP one can get very high apparent throuput because the excess packets may
be discarded. UDP does NOT have the acknowledging mechanism as TCP has. You can
check how many packets got to the destination with tcpdump. Some estimation is
possible with usage of echo service:

udpblast -r pingwin:echo

read SO_SNDBUF = 8192
Sending non-random UDP data to pingwin:echo using 1024 B blocks.
Written/Read   300/201 KB   5837.71/461.34 KB/s     ^C


tcpblast -p 40023 step

Send/receive from/to port 40023. I needed it for one of the traffic limits
tests.


Simple rate limit (to 10000 B/s):

tcpblast -R 10000 rzm-ac


Advanced rate limits:

tcpblast -c 9999 -R 10000,5:20000,5 -l 10 -vvv rzm-ac

Sends 9999 blocks. The RATESPEC 10000,5:20000,5 says to send 10000 B/s for 5 s,
then 20000 B/s for another 5 s. '-l 10' additionally shows the speed for last
10 blocks. -vvv displays the time, speed in B/s and b/s.

The result

Written   147 KB  in 10002.8 ms   120389.2 b/s   15048.6 B/s   14.70 KB/s  (last 10 KB: 19692.3 B/s)

shows the final speed in B/s as more less 15000 B/s - it is an average of 10000
and 20000 B/s, 5 s each.

For high speeds the TCP buffer size and time used for displaying speed
continuously matter.

In the last (or only) RATE,TIME in RATESPEC the TIME can be omitted. This means
an infinite time.


Recent version can use units:

tcpblast -b 4KB -c 10k -R 10kbps,2:20kbps,3s target

In this somewhat artificial example we are:
- trying to set 4 KB buffer
- sending 10 K == 10240 blocks; lower case 'k' is always the same as 'K' equal
  to 1024
- sending 10 KB/s (again lower case 'k' is 1024, 'b' in 'bps' is 'B', i.e.
  byte) for 2 seconds (no unit specified, default for time is 's')
- and then sending 20 KB/s for 3 s
to the target.


		PORTS

Done and tested (20000711):
- Linux Rawhide 19991031, Sparc, 19991102
- Linux RedHat 6.0, i486, 19991109; 6.2, i686 - 20000711
- Solaris 2.6, Sparc, 19991102
- Solaris 2.7, Sparc, 20000725 (sparc-sun-solaris2.7)
- FreeBSD 4.0, i686, 20000711 (hm.. no getopt.h?)
- AIX 4.1, powerpc, 20000725 (powerpc-ibm-aix4.1.4.0)
- IRIX 6.3, mips, 20000725 (mips-sgi-irix6.3)
- OpenBSD 2.7, ix86, 2000810 (i386-unknown-openbsd2.7)

20001017:
- Linux RedHat 6.2
- Solaris 2.6, 2.7

20001026
- Linux RedHat 6.2
- Solaris 2.6, 2.7
- FreeBSD 4.0

20010620
- Linux RedHat 6.2 i386, Sparc32
- Solaris 2.6
- does not compile on Solaris 2.5.1
- FreeBSD 4.3
- OpenBSD 2.8
- AIX 4.1.4 powerpc

20011110
- Linux RedHat 7.2 i386
- Linux RedHat 6.2 sparc
- Solaris 2.5.1, 2.6, 2.8 sparc
- FreeBSD 4.3 i386
- OpenBSD 2.8 i386
- AIX 4.1.4 powerpc
- IRIX 6.5 mips

2012-05-18
- Scientific Linux (RHEL) 6.2, x86_64


		BUGS

- I'm a perfectly bad and careless maintainer
- we have memory leaks: in getaddrinfo() (?!) as ccmalloc shows: 4595 bytes in
  79 chunks - is it real?
- autoconf system is somewhat shaky here

Patches for these and other problems can be sent to: rzm@icm.edu.pl
