How can I stop iperf server when it finishes? How can I stop iperf server when it finishes? unix unix

How can I stop iperf server when it finishes?


In iperf3, you can just give the -1 parameter and it will close automatically. It only accepts one connection and it will exit when that is finished.

Example: % iperf3 -s -B 192.168.20.10 -p 70011 -1


use iperf option -t . So that it will stop after t seconds. Default iperf client timeout is 10 seconds. so it stops after that.

Try. Here both will stop after 10 seconds.

Server: iperf -s -t 10

Client: iperf -c <ipaddress> -t 10


I think it depends on the version. I can speak for iperf 2 where we recently added this capability. When the -server is launched there will ultimately be two threads per the "server", a listener thread and a traffic (receiver/server) thread. So -t does a few things, it sets the listener thread timeout and the traffic threads' times. The listener thread is the parent of the traffic thread so it must wait for the traffic threads to complete before it can terminate.

Example: Let's say one issues iperf -s -t 30 which will keep the listener around for 30 seconds. If no clients present themselves within 30 seconds the "server" terminates after 30 seconds. But if 20 seconds after the iperf -s -t 30 a client connect, e.g. iperf -c <server> -t 30, then the listener/server will to stay around for 20 + 30 seconds before terminating. (Note: The client's -t <value> isn't passed to the server so the server -t needs to be equal or greater than the clients -t.)