		TCPBLAST - NETWORK BANDWIDTH MEASURING TOOL

Tcpblast can be used for:
- crude network throuput measurements
- testing bandwidth limits (in both directions)

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

WARNING: tcpblast is really crude and measures the throuput by sending as much
data as possible. USE CAREFULLY. For much more subtle bandwidth measurements
use
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:
- gives immediate results
- cloggs the link - good for testing actual bandwidth limits (like CBQ+TBF)
- bidirectional
Contra:
- needs discard or echo service
- wastes bandwidth
- bottleneck measurement only


		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


		RECENT VERSION

The newest version is available in
ftp://ftp.6bone.pl/pub/blast/


Discussion list, subscribing:

echo subscribe tcpblast | mail majordomo@sunsite.icm.edu.pl

messages to:

tcpblast@sunsite.icm.edu.pl


		OPTIONS

WARNING: most of the options changed since version 19991109!

Usage: ./tcpblast [options] destination[:port]

tcpblast/udpblast is a simple tool for probing network and estimating its
throughput. By default it sends 300 of data to specified destination host.
Each block has 1024 B by default.

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..9999
-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
-r, --read       read data returned to us, switches default port to echo
-s BLOCK_SIZE    block size (default 1024 bytes)
-t MAXTIME       limit time to MAXTIME s
    --tcp        use TCP (default)
    --udp        use UDP (default if named udpblast)
-v, --verbosity  verbosity, default 0, maximum 3
-V, --version    version
destination      host name or address
port             use port #/name xyz instead of default 9


		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 of discarded packets.
UDP does NOT have the acknowledging mechanism as TCP has. You can check how
many packets got to the destination with tcpdump - usually much less than sent.
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.


		CHANGES

- setting TCP/UDP
- setting block size
- setting buffer size
- sending random data
19960224 version released
19960926 setting port # 
         uploaded to sunsite.unc.edu
19961001 option for setting # of dots per block sent 
         some cleanup
19961002 better description of -b in usage()
         corrected bug in setsockopt (buffer wasn't set)
         for -r buffer still wasn't filled with random data (Pratip K. Banerji <pbanerji@bbn.com>)
         version 961002a
19961003 usage_small() used in same cases instead of usage()
         some help/error messages rearangement
19961028 getopt from GNU libc 961017 included
         #include <errno.h>
         compiles+links on Solaris 0.5
         more files, Makefiles and such
19970119 -c option for continuous speed display
         either port # or name can be used with -p
         SunOS (4.1.3) compile target works
19981108 included DEC OSF/1 changes from Arun Moorthy <moorthy@cs.iitm.ernet.in> (sent Feb 97,  sorry..)
         getsockopt() should know how much space can it use for returned parameter, so size must be 4
         output shows data/time and (data-bufsize)/time. far from perfect, take a look
         y2k problem in version number (:
         install target
19981109 printresult() in a loop arguments corrected
         -e(xperimental) option
         default port now properly printed
19981112 dist Makefile target
         changed . into - in the package name
19990326 install udpblast too (as a symlink)
         version.h depending on tcpblast.c
19990504 2 spaces after 'KB/s'
	 I don't understand why
write(3, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 65536) = -1 EFAULT (Bad address)
write(2, "tcp/udpblast send:: Bad address\n"..., 32tcp/udpblast send:: Bad address
) = 32
	 with -s 65536. It works OK up to 46648 B (?!)
19991102 configure.in and such borrowed from nmap
	 Karsten Hecker <karsten@merlin.nrw-online.de> had problems compiling it on Solaris, should work with configure
	 Michal 'Orr' Daszkowski <midas@ufik.idn.org.pl> spotted a long standing bug in port arg copying
	 included a manual from Artur R. Czechowski <arturcz@bofh.org.pl>, I'm sure it is going to be outdated soon
	 moved binary do ..../sbin
19991103  -c  (continuous) is default now, instead of dots
	 millisecond = ms (not msec)
	 time scaling when adding s and us (USCALE)
	 circular buffer for measuring last nnn blocks speed, the option: -l nnn  (off by default)
19991103a one more correction to port arg copying
19991104 massive rewrite, mostly for bidirectionality
	 summary on ^C
	 both read and write are O_NONBLOCK
	 can run RO, RW, WO
19991108 htons(port) (Peter Barton <pbarton@i3s.net> was complaining on it, backported to 19991103a)
19991109 changed options letters
19991116 small fatal error, this version can be considered beta
	 RPM made
20000525 small changes in source and README, UDP example
	 -r changes default port to "7" (echo)
	 -i DELAY  option implemented, seems to not to scale below 30000 us
20000711 -p PORT  for specifing local port


		PORTS

Done and tested:
- Linux Rawhide 19991031, Sparc, 19991102 rzm
- Linux RedHat 6.0, i486, 19991109 rzm; 6.2, i686 - 20000711 rzm
- Solaris 2.6, Sparc, 19991102 rzm


		TODO

- port to more unices, should be easy with autoconf
- add even more options
  - sending file contents - -f
  - comparing when write-read, like tcpblast-dfk or tcpspray
- what netperf can offer?
- learn more theory and think how to improve accuracy of bandwidth
  measurement (maybe it could be corrected for the buffer size.. - doesn't help
  much 19981108) (-b 1024 gives more reasonable results)
- clean up after stealing *.in scripts
- ipv6ify!
- separate standalone (high performance?) discard/echo/chargen - there may be
  such already


		BUGS (and patches send to the address below if found)

- I'm a perfectly bad and careless maintainer

rzm@icm.edu.pl
