I am trying to automate iperf3 using c#. The problem is that for some reason the iperf3 output is redirected once the iperf test is done and does not redirect it in real time.
public void RunIperf()
{
{
sortOutput = new StringBuilder();
this.dummyProcess .OutputDataReceived += CaptureOutput;
this.dummyProcess .ErrorDataReceived += CaptureError;
this.dummyProcess .Start();
this.dummyProcess .BeginOutputReadLine();
this.dummyProcess .BeginErrorReadLine();
this.dummyProcess .WaitForExit();
}
static void CaptureOutput(object sender, DataReceivedEventArgs e)
{
ShowOutput(e.Data, ConsoleColor.Green);
}
}
This code works for iperf2 wherein I get data on my console in real time but not for iperf3. I am not sure what the issue is.