进程间通信/广播
我有一个 Windows 服务(用 C# 实现)和一个类似服务控制管理器的东西。我想跟踪从服务到服务控制管理器(这是一个窗口窗体应用程序)的消息,但我不确定执行此操作的最佳方法是什么。该服务应将消息广播给以非阻塞方式列出的所有客户端。
我考虑过使用命名管道或邮槽,但我不确定是否有更好的方法来做到这一点(我也不确定是否可以用这项技术实现广播)。
任何建议将不胜感激。
I have a Windows Service (implemented in C#) and I have something like a service control manager. I would like to trace messages from the service to the service control manager (which is a window forms application), but I'm not sure what's the best way for doing this. The service should broadcast the messages to all clients who are listning in a nonblocking manner.
I have considerd using named pipes or mailslots, but i'm not sure if there is a better way for doing this (I'm also not sure if I can implement the broadcating with this technology).
Any advice would be greatly apreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有多个客户端正在监听,我认为命名管道会需要更多工作。我认为对于这种情况,共享内存会更简单。如果客户端可能位于单独的计算机上,并且不涉及大量数据,那么诸如多播之类的东西可能是传输信息的简单方法。然而,多播范围通常仅限于单个子网,除非路由器专门配置用于多播。
If there are multiple clients listening, I think named pipes would be a little more work. I think shared memory would be simpler for that situation. If the clients might be on a separate machine, something like multicast might be a simple way to transmit the information if there is not a lot of data involved. However, multicast range is typically limited to a single subnet unless the routers are specifically configured for multicast.