1

我正在尝试使用 c# 自动化 iperf3。问题是,由于某种原因,一旦 iperf 测试完成,iperf3 输出就会被重定向,并且不会实时重定向。

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);
    }
}

此代码适用于 iperf2,其中我在控制台上实时获取数据,但不适用于 iperf3。我不确定问题是什么。

4

1 回答 1

3

尝试使用--forceflush标志到 iperf3。

于 2017-04-24T20:25:41.343 回答