OutputDataReceived(和 ErrorDataReceived)的触发速度较慢,并会创建较大的缓冲区

发布于 2024-09-30 16:41:55 字数 146 浏览 1 评论 0原文

有没有办法提高 .NET 中 Process 对象抛出 OutputDataReceived 事件的速率?它创建了一个大缓冲区(我相信有 1024 个字符),该缓冲区被批量转储,这使得应用程序不像我希望的那样像流一样流畅。

先感谢您!

is there a way to increase the rate a Process object in .NET throws the OutputDataReceived event? It creates a large buffer (I believe 1024 characters) that is dumped in bulk which makes the application not as fluid of a stream as I would of like it to be.

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘过的浮云 2024-10-07 16:41:55

仅在以下两种情况下才会触发 Process.OutputDataReceived 事件。

  1. 输出中遇到换行符
  2. 收到完整数据

因此,当且仅当输出流中有换行符时,事件才会被触发,否则它将等待完整数据,然后事件才会被触发。

我刚测试到968000字节。仅在接收到整个数据后才会引发事件,因为我没有在输出中保留任何换行符。

Process.OutputDataReceived event is fired only in following two conditions.

  1. Newline is encountered in output
  2. Complete data is received

So if and only if you have a newline character in your output stream event will get fired else it will wait for complete data then the event will get fired.

I just tested it till 968000 bytes. Event is raised only after entire data is received as I have not kept any newline character in the output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文