I'm creating an application that will be installed on a few computers on a local network. As soo开发者_如何转开发n as the application is launched, it must talk to all other instance on the network to tell them that it's just been launched. This way, any instances on the network know about all other instances.
This could be used, for instance, to manage floating licences of my application.
Any idea on how to do this in .Net (C# preferred)
Many thanks Julien
You can do this with WCF, which does support Peer to Peer communications.
Assuming you have a way to know the addresses of the installed clients.
You could easily implement the communication between hosts using WCF and C#.
You'll probably have to broadcast a UDP message. This will generally only work on the local subnet.
If the real goal is to have all of the instances be able to talk to each other, in some cases it can be easier to have a single (known) point of contact for all instances rather than a full peer-to-peer mesh. Less connections to manage often means less headaches.
Multicast can be used for this type of operation.
If you are looking for popular/standardized solutions, I think Bonjour is a good one,
http://en.wikipedia.org/wiki/Bonjour_%28software%29
http://www.mono-project.com/Mono.Zeroconf
精彩评论