我正在尝试使用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。我不确定问题出在哪里。
发布于 2017-04-25 04:25:41
尝试对iperf3使用--forceflush标志。
https://stackoverflow.com/questions/39151814
复制相似问题