.TH TTCP 1 "10 October 1993" .SH NAME ttcp \- test tcp, tcp/udp to stdin/stdout passthru .SH SYNOPSIS .B ttcp .B \-t/-r [ .B \-kqsuQ] ] [ \-b .I sobuflen ] [ \-l .I len ] [ \-n .I nbuf ] [ \-p .I port ] [ .I host ] .SH DESCRIPTION .B ttcp is a program which exists for two basic purposes. First, it can be used to test the TCP/UDP protocol stacks by using it in the sink/source mode. The second use is as a program to connect TCP/UDP data streams to stdin/stdout. This program will either await an incoming connection or initiate a connection to another host according to the options. Upon completion, a report of the cpu time used and the network throughput are given. A condensed summary is also available. .SH OPTIONS .LP When a .I hostname is specified on the end of the command line, .B ttcp will initiate the connection to the remote side. The other side must have a pending listen on the desired port. The flow of data is independent of the direction of connection. In read mode, .B ttcp reads from the socket and writes to stdout. In write mode, .B ttcp reads from stdin and writes to the socket. .TP .B \-l .I len specifies the amount of data passed to/from the kernel on each read or write system call. This defaults to 1024 bytes. .TP .B \-n .I nbuf specifies the number of buffers to be read or written to/from the network. The total amount of data transfered will be the product of the number of buffers and their size (\fIlen * nbuf\fR). In read mode, .I nbuf defaults to 0 which implies read until EOF. In write mode, .I nbuf defaults to 1024. .TP .B \-p .I port specifies the TCP or UDP port to be used for communication to the remote side. (default 2000) .TP .B \-b .I sobuflen allows you to override the system default socket buffer size. Altering this can dramatically effect the throughput of TCP in may circumstances. (defauld 32768) .TP .B -B only output full blocks, as specifed in the .B -l option. This is useful with things like tar that do not like partial blocks. .TP .B -k set TCP keepalive socket option. .TP .B -q quiet, progress messages and only a single summary line. .TP .B -Q Quiet! One line sumary only. .TP .B \-s source/sink mode. .B ttcp sources data from an internal buffer in write mode, and discards all data received in read mode. This provides the best test of the network stack without interfence to the test timing from file I/O or data moving. .TP .B -u use UDP instead of TCP. This is raw UDP transmissions with no mechanisms for data integrity or message encapsulation. Its basically only useful for abusing the UDP protocol stack in test situations. The time it takes the sender to complete is a good number, as is the percentage received by the client. .SH EXAMPLE .ta .6i 1.2i .RS The classic use of ttcp is to test the TCP throughput between two hosts. The following test would send 8 megabytes from lion to tiger with 8k buffers being written to the TCP subsystem. The two processes will communication on port 4321. They use the sink and source mode so no date is read or written from stdin/stdout. .sp On host tiger: .br ttcp -r -s -p4321 .br On host lion: .br ttcp -t -s -p4321 -l8192 -n1024 tiger .RE .sp .RS This next example demonstrates using ttcp to connect stdin and stdout to a TCP connection to do a remote dump: .sp On server system: .br ttcp -r -p2001 -l8192 > dump.root.Z .br On client system: .br dump 0uf - / | compress | ttcp -t -p2001 -l8192 serverhostname .RE .SH "SEE ALSO" cat (1), dd(1), socket(2) .SH AUTHORS Originally written at the U.S.Army Ballistics Research Laboratory by Mike Muuss, with numerous improvements from others.