简体   繁体   中英

How to do inter-process communication between two instances of the same application?

I was thinking of using WCF, but then the endpoints would collide. What are the other options?

The endpoints will collide because the second instance will be created from the same executable file.

您可以使用任何进程间通信原语(内存映射文件,消息传递,管道或仅标准套接字)...,也可以仅基于给定实例(例如,基于进程ID) 动态定义端点

Whatever IPC mechanism you choose, the basic issue is the same - you will have resource collisions unless you configure the instances individually to use disjoint local resources (though in such a way that each instance pair can connect as required). It makes a difference whether you need just point-to-point (and how the target for a given outbound message is determined), or the ability to broadcast to all active instances.

Seems to me that the answer to this question is really "use the one that best meets your requirements", with a harder followup question on how to configure the instances to make that work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM