当进程可以来来去去时,如何在 C# 中进行进程间通信?
我有 2 个进程 WriterProc 和 ReaderProc。
WriterProc 仅写入,ReaderProc 仅读取。我可以使用命名管道进行通信,但问题是 ReaderProc 在 writer 编写时可能不存在,反之亦然。
两者可以同时处于活动状态,因此可能需要写入和读取之间的同步。
c# 4 中建议的方式是什么?
I have 2 process WriterProc and ReaderProc.
WriterProc only writes and ReaderProc only reads. I can use named pipes for communication but the problem is ReaderProc may not be alive when writer is writing it or vice-versa.
Both can be active at the same time so synchronization between writes and reads may be required.
What would be suggested way in c# 4?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
消息队列服务专为在像您这样的情况下使用而设计。它们提供有保证的消息传递,因此如果写入器在读取器未运行时忙于写入,则读取器在启动后会发现一个充满消息的队列。
Message Queuing services are designed for use in situations like yours. They provide guaranteed message delivery, so if the writer was busy writing while the reader was not running, the reader would find a queue full of messages after starting up.
让它们成为 WCF 怎么样?
写入器 WCF 将在即将读取时向读取器 WCF 发出停止读取信号,然后在写入完成后发出信号。
How about making them WCFs.
The writer WCF will signal Reader WCF to stop reading when it is about to read and then signal once writing is done.