开发者

How to communicate with .net processes when there are multiple instances of them

开发者 https://www.devze.com 2022-12-18 19:07 出处:网络
I have multiple instances of the same Windows Forms .net 3.5 SP1 C# application running on the same machine.

I have multiple instances of the same Windows Forms .net 3.5 SP1 C# application running on the same machine.

Now I'd like to be able to communicate with them from .net, one instance at a time. What's the most simplest way to do this?

I read a bit about WCF, but I have only found examples working with one server and one client. But in my case all running instances would be a server and I need to discuss with just one of them.

I imagine something like this:

Process[] procs = Process.GetProcessesByName("ProcessName");开发者_StackOverflow
foreach (Process p in procs)
{
  // Communicate with process here
}


You'll need some kind of subscribe/callback mechanism. Don't loop through the projects, but have each application subscribe to a wcf service method instead.

Example: http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx


The simple thing is database :) , btw WCF support peer to peer communication with NetPeerTcpBinding

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号