Programming Guide

The following sections provide sample code describing how to use µC/IPerf.

API reference

Include Files

Wherever you want to use µC/IPerf, you should include the following header:

Include file
Description
Source/iperf.hContains µC/IPerf API definitions

Module initialization

Function name
Description
IPerf_Init()Initialize µC/IPerf module's objects and tasks. This function must be called prior to any other API


Run an IPerf test

Function name
Description
IPerf_TestStart()Create and launch an IPerf test.

IPerf_Reporter()

Terminal reporter that output the results during an IPerf test.

Shell reference

Prerequisite

µC/TCP-IP command module.

Include Files

Wherever you want to use initialize the command in µC/Shell, you should include the following header:

Include file
Description
Cmd/iperf_shell.hContains c Command definitions

API

Function name
Description
IPerf_InitShell()Function to load IPerf command into shell.

Command reference

The IPerf Shell module include only one command which is "iperf". The following table show the multiple options associated to this command.


Option
Description
TypeUsage example
-sCreate and launch an IPerf test as a server.Server only

iperf -s

-cCreate and launch an IPerf test as a client. In client mode, the command must specified the IPerf test server adress to connect to.Client onlyiperf -c 192.168.0.2
-hPrint the available argument to the "iperf" commandGeneraliperf -h
-vPrint the version of the IPerf moduleGeneraliperf -v
-f

Specified the format of the data saved.

General

iperf -s -f b

-tThe time in seconds to transmit for. Iperf normally works by repeatedly sending an array of len bytes for time seconds. Default is 10 seconds. See also the -l and -n options.Client onlyiperf -c 192.168.0.2 -t 10
-nThe number of buffers to transmit. Normally, Iperf sends for 10 seconds. The -n option overrides this and sends an array of len bytes num times, no matter how long that takes. See also the -l and -t options.Client onlyiperf -c 192.168.0.2 -n 200000
-lThe length of buffers to read or write. Iperf works by writing an array of len bytes a number of times. Default is 8 KB for TCP, 1470 bytes for UDP. Note for UDP, this is the datagram size and needs to be lowered when using IPv6 addressing to 1450 or less to avoid fragmentation. See also the -n and -t options.Generaliperf -s -l 4096

-p

The server port for the server to listen on and the client to connect to. This should be the same in both client and server. Default is 5001, the same as ttcp.Generaliperf -s -p 5001
-uUse UDP rather than TCP. See also the -b option.Generaliperf -s -u
-wSets the socket buffer sizes to the specified value. For TCP, this sets the TCP window size. For UDP it is just the buffer which datagrams are received in, and so limits the largest receivable datagram size.Generaliperf -s -w 4096
-DRun the server as a daemon (Unix platforms)  On Win32 platforms where services are available, Iperf will start running as a service.Server onlyiperf -s -D
-VBind to an IPv6 address Client onlyiperf -c fe80::1234:5678 -V
-iSets the interval time in seconds between periodic bandwidth, jitter, and loss reports. If non-zero, a report is made every interval seconds of the bandwidth since the last report. If zero, no periodic reports are printed. Default is zero.Generaliperf -s -i 1