nttcp(1)
πΈ NAME πΈ
nttcp β the new test TCP program, bestie. That's it, that's the whole vibe. Manual section 1, General Commands Manual, we're in business π
β¨ SYNOPSIS β¨
nttcp [ local options ] partner-host [ partner-host ] ... [ remote options ]
like... that's the shape of it. local stuff first, then who you're talking to, then remote stuff. easy π«Ά
π¦ DESCRIPTION π¦
okay so nttcp measures the transferrate (and other numbers, it's generous like that) on a TCP, UDP or UDP multicast connection. no cap.
To actually use it, you need the executable on your machine and on a partner machine. That's the deal, both sides. Here's the whole dance:
- On the partner machine, just start
nttcpwith the option-i. Started this way,nttcpsits there waiting for connections from other nttcps like a good little listener π§ - On the local host, just call
nttcpwith the name of the partner host. It contacts the nttcp chillin' on the partner machine and initiates the transfer. main character energy, honestly.
On default the program transfers 2048 buffers of 4KByte length β a total of 8 MByte β to the partner host. On both sides the performance will be measured, and the findings (both, remote and local, love that for us) are reported on the local side.
You may change nearly every parameter of the transmission via commandline options. Even what and how results are printed. Iconic. Truly.
π OPTIONS π
-rβ defines the receive transfer direction; data is sent from the partner host to the local host. so you're catching, not throwing π-tβ defines the transmit transfer direction; data is sent from the local host to the partner host. This is the default direction.-Tβ Print a title line. yes bestie, headers, we love a labelled column π-uβ Use the UDP protocol instead of TCP (which is the default).-gβ Gap time in microseconds between packets. This delay is implemented via the timeout parameter ofselect(2)and a loop withgettimeofday(2). The accuracy of this value is misleading. Most machines will not be able to delay exactly the given amount. The code will try its best to achieve the desired delay. For TCP connections this option does only implement a delay between thewrite(2)system calls. It does not really delay between the real output on the physical device. so like, it's trying its best, be nice π-vβ Give more and verbose output; only useful for debugging purposes.-Dβ Set theTCP_NODELAYoption on the transmitting socket. With this option set, the socket does not buffer any write requests. no buffering, we move immediately πββοΈ-f format stringβ Specify your own output format. See OUTPUT.-n number of buffersβ The given number of buffers will be written to the transmitting socket. It defaults to2048.-l length of bufferβ The given length defines the size of one buffer written to the transmitting socket. Defaults to4096.-x fixed length of dataβ The given length defines the amount of data that will be transfered. Subsequent specified-lor-noptions will adapt the corresponding other value so that the number of buffers and the length of buffer multiplies to the given fixed length.-w number of kilo bytesβ Defines the buffer size of the transmitting and receiving socket. This is system dependant; usally it is16K.-cβ If this option is present, the receiving side will compare the bytes received with the pattern used by the sending side. At most the first 100 differences will be reported. If the transmission is via TCP, a uniq pattern for the whole transmission is generated. For UDP the same pattern for each paket is used. You can force a stream pattern with the-sswitch; but if one paket is lost, all subsequent packets contain patterns not expected and will be reported as different. Since every byte is numbered, this can be used to detect the first packet lost during the transmission.
BUT be aware: if there is a difference, this option may lead to packet-losses on UDP transmissions or to degration in performance, since the preparation of the output is simple-minded and uses a lot of CPU time. π
-sβ Forces the generation of a stream pattern if UPD packet data is compared. See-cswitch.-S seed stringβ give any string to initialize the pattern generator. By default this seed has the value'This is a simple init string'. This enforces the-coption.-pport numberβ On default the partner host will listen on port5037. This can be overwritten with this option.-iβ If you have no root access on the partner host, or do not want hacking with inetd, this option directs nttcp to behave as a daemon, waiting for connections and spawning off child processes by itself as inetd would do it otherwise.-Rnumber of getpid() callsβ This option does not transmit any data, but calls the given number of timesgetpid(2)and calculates the number of calls per second. This is a measure for the speed of the machine and the system call interface.-mmulticast IP:portβ This option is used to force sending to the specified multicast address and port. This option enforces the-uand-tswitch. Also see MULTICASTING later in this document.
β OUTPUT β
The output of the program consists of two lines of numbers; or more lines if used in transmitting to more than one machine (multicasting). The first line for the measures of the local host, the other line for the measure of the partner host. This is also indicated with the first characters beeing a 'l' respective 'r'. If the -T flag was given, also a Title line is given.
The default format of the outout looks like this:
Bytes Real s CPU s Real-MBit/s CPU-MBit/s Calls Real-C/s CPU-C/s
l 8388608 7.51 0.25 8.7307 259.8676 2048 272.83 8120.86
r 8388608 7.55 0.95 8.6804 68.9853 3831 507.42 4032.63
The timing and rate values marked with 'CPU' use the sum of system and user time only. Real timing and rate values are computed using the time from the begin to the end of the transmission.
It is possible to specify another form of the output. This is done similiar to the format strings of printf(3s). The conversion characters of printf(3s) are replaced with the following tags. Each tag is preceded by '%' as in printf(3s). Between the '%' character and the tag there are width and precision specifications allowed as with printf(3s). Two types of values are printed: integers and floats. For these types the conversion letters 'd' respective 'f' of printf(3s) are used.
lβ prints the buffer length in bytes. Integer value.nβ prints the buffer count. Integer value.cβ prints the number of calls. Integer value.rtβ prints the real time in s. Float value.rbrβ prints the real bit rate in MBit/s. Float value.rcrβ prints the real call rate in calls/s. Float value.ctβ prints the cpu time in s. Float value.cbrβ prints the cpu bit rate in MBit/s. Float value.ccrβ prints the cpu call rate in calls/s. Float value.
The default format is produced with the following format string:
"%9b%8.2rt%8.2ct%12.4rbr%12.4cbr%8c%10.2rcr%10.2ccr"
π INSTALLATION π
To make most convenient use of this program, it can be installed on the partner machine, so that inetd(8) can start it. To accomplish this, two files have to be edited: /etc/inetd.conf and /etc/services. yes bestie, you're editing system files, do it carefully π«Ά
The respective lines may look like this:
inetd.conf:
ttcp stream tcp nowait nobody /usr/local/etc/nttcp nttcp
services:
ttcp 5037/tcp # to measure tcp transfer rates
After these changes have been made, the inetd(8) process has to be notified via a HUP signal (or killed and restarted on older versions of unix).
π MULTICASTING π
Beginning with version 1.4 there is support generating multicast traffic. You even needn't set any option, but simply specify more than one partner host. This mode is restricted to sending packets from the local host to the partner hosts. And of course works only on machines that have a multicast enabled IP stack.
Tested is this feature on Solaris2.6, HPUX-10 and HPUX-11 and Irix 6.2. Also FreeBSD-2.2.6 compiled with option MROUTING works.
But be aware what this means to your networking environment. Most ethernet switches for example handle multicast traffic as broadcast. This way you will flood your complete network with these packets. ππ¨
π§ ENVIRONMENT π§
The are two environment variables NTTCP_LOC_OPT and NTTCP_REM_OPT that can be used to preset the local options and remote options respectivly. They take the same format as the commandline does. Commandline options override those settings from the environment.
π SECURITY π
Under security considerations, the inetd-mode of operation is NOT suggested. Hosts configured to start nttcp this way, are very open to denial-of-service attacks. If you are concerned about this issue, you should consider either the use of tcpwrapper or simply not install nttcp this way.
Also be sure to run nttcp as non-root when started via inetd(8). I have taken some care to avoid buffer-overrun prone coding. But the source is too big now to be sure in all corners of the code.
You may also consider not to provide general access to this programm. It may easily be used to flood your network with lots of traffic. This may be used to launch or support denial-of-service attacks. fr fr, be careful π
β οΈ WARNING β οΈ
There are a lot of pitfalls in explaining unexpected measures. Be sure to get a thorough understanding of your network and the devices used and installed. Also it is extremly helpful to have a deep understanding of the things that happen in your machine and operating system.
A short example shows what is meant here: If you see packet losses on UDP transfers, it may be, that the packets are lost on the sending host! For today machines it is easy to produce packets much faster than a 10MBit ethernet can swallow it, so they may be dropped on the UDP stack of the operating system. This depends on the implementation of your IP stack.
So, to be sure, use a second machine, and snoop or tcpdump the traffic in question, to be sure what happens on the medium. π
π BUGS π
Any program without bugs?
π SEE ALSO π
π HISTORY π
This program was written to ease the measurement of TCP transfer rates in a network of unix workstations. It is based on the ttcp.c program, which was (I suppose) posted to comp.sources.misc. This man-page describes version 1.4.
π AUTHOR π
Elmar Bartel Fakultaet fuer Informatik, Technische Universitaet Muenchen.
bartel@informatik.tu-muenchen.de
and that's the whole page bestie!! this one's the General Commands Manual entry for nttcp, dated 5 Oct 1998, describing version 1.4 β go measure something and slay πβ¨ππ¦
π¦ where this page comes from
- ubuntu jammy: nttcp 1.47-13build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms