How to fix iperf connect failed: Operation in progress

Problem:

When running iperf -c [IP address] you see this error message:

connect failed: Operation in progress

Solution:

You are running different iperf versions on the server and the client. Typically this error occurs if the client is running iperf 2.x whereas the server is running iperf 3.x.

Check using iperf --version. In my case, on the client, it was

iperf version 2.0.13 (21 Jan 2019) pthreads

on OpenWRT.