OutputDataReceived(和 ErrorDataReceived)的触发速度较慢,并会创建较大的缓冲区
有没有办法提高 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅在以下两种情况下才会触发 Process.OutputDataReceived 事件。
因此,当且仅当输出流中有换行符时,事件才会被触发,否则它将等待完整数据,然后事件才会被触发。
我刚测试到968000字节。仅在接收到整个数据后才会引发事件,因为我没有在输出中保留任何换行符。
Process.OutputDataReceived
event is fired only in following two conditions.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.