我需要使用本机 C++ (.NET 不适用)在 Win32 中实现进程(在机器范围内)的进程间通信系统。有关更多详细信息,我正在考虑使用二进制格式消息的进程之间的消息路由系统。消息发送/接收必须是异步的。
TCP 套接字可能是选择之一。但是,我只是想知道是否有更好的高性能选择。 (我可以忽略安全问题。)
我不要求详细的代码,而只是要求您的见解。
I need to implement inter-process communication system for processes (in machine-wide) in Win32 using native C++ (.NET is not applicable). For more detail, I'm considering message routing system between the processes using binary formatted messages. Message sending/receiving must be asynchronous.
TCP socket could be one of the selection. But, I just want to know if there could be better choice for high performance. (I can ignore security problems.)
I'm not requesting detailed code, but just your insights.
发布评论
评论(3)
如果您有空闲时间,并且喜欢冒险和实验,则可以使用未记录的 Windows 功能:本地过程调用。它永远存在,而且可能是最快的,因为它是所有其他的基础。
If you have some time to spare, and if you like risk and experimentation, you can use the undocumented Windows feature: Local Procedure Call. It's been there forever, and it's probably the fastest, because it's the foundation for all others.
您也应该看看命名管道: http ://msdn.microsoft.com/en-us/library/aa365590%28v=vs.85%29.aspx。我也知道 IPC 的 MemoryMappedFiles: http://msdn.microsoft.com/en -us/library/ms810613.aspx,但我个人从未尝试过。我在单机 IPC 策略上同时使用了 NamedPipes 和 Socket,但坦率地说,我从未测量过两种方法之间的性能差异,或者至少我没有注意到这么大的差异来说“避免这个......”或“更喜欢这个其他” ……”。也许从您更有信心的技术开始会给您带来良好的工作成果和更多的空闲时间;)
You shoul have a look at named pipes too: http://msdn.microsoft.com/en-us/library/aa365590%28v=vs.85%29.aspx. I know of MemoryMappedFiles too for IPC: http://msdn.microsoft.com/en-us/library/ms810613.aspx, but I personally never tryed. I used both NamedPipes and Socket on a single machine IPC strategy, but I frankly nevear measured performance difference between the two approach, or at least I did not notice a so big difference to say "avoid this..." or "prefer this other...". Maybe starting with the technology you are more confident in will give you a good working result, and more free time ;)
我是内存映射文件的粉丝。
用读/写锁包裹以提供访问限制。
I'm a fan of memory mapped files.
Wrapped with reader/writer locks to provide access restrictions.