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.h | Contains µ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. |
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.h | Contains 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 | Type | Usage example |
---|---|---|---|
-s | Create and launch an IPerf test as a server. | Server only | iperf -s |
-c | Create and launch an IPerf test as a client. In client mode, the command must specified the IPerf test server adress to connect to. | Client only | iperf -c 192.168.0.2 |
-h | Print the available argument to the "iperf" command | General | iperf -h |
-v | Print the version of the IPerf module | General | iperf -v |
-f | Specified the format of the data saved. | General | iperf -s -f b |
-t | The 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 only | iperf -c 192.168.0.2 -t 10 |
-n | The 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 only | iperf -c 192.168.0.2 -n 200000 |
-l | The 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. | General | iperf -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. | General | iperf -s -p 5001 |
-u | Use UDP rather than TCP. See also the -b option. | General | iperf -s -u |
-w | Sets 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. | General | iperf -s -w 4096 |
-D | Run the server as a daemon (Unix platforms) On Win32 platforms where services are available, Iperf will start running as a service. | Server only | iperf -s -D |
-V | Bind to an IPv6 address | Client only | iperf -c fe80::1234:5678 -V |
-i | Sets 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. | General | iperf -s -i 1 |