As a requirement, I need to start iPerf server and client on the same linux
machine to get two-way network statistics. Server will
be continuously running daemon.
For client, traffic need to be pushed through particular Ethernet port using
-B option. This client will communicate with iperf server on other machine.
I did Following steps,
1. Start the iperf server on linux machine (iperf –s )
2. Start the iperf client on same linux machine with –B argument ( perf –c
OTHER_MACHINE_IP –B LOCAL_IP).
Client unable to bind to given LOCAL_IP.
Is there any way to do this?
I looked into the code, problem is with the way bind is done in
Client::Connect (Client.cpp) call.
Before this bind, SockAddr_localAddr (SocketAddr.c) sets mPort for
inSettings->local to bind the local socket on mport.
Since server is already bind to this port, client call fails. But this port
binding is not required in case of client since -B option indicates to bind
to particular local IP address and not to the specific port.
Fixing the problem at my end, I am able to run iperf client with -B option
when server is running.