1

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.

DBB
  • 467
  • 9
  • 23
  • On further investigation it seems that iperf3 has an issue of storing the output in the stdout buffer. I am wondering there is anyway to flush that information out of the buffer. – DBB Aug 25 '16 at 21:56

1 Answers1

3

Try using the --forceflush flag to iperf3.

Bruce A. Mah
  • 386
  • 1
  • 6