Communicating Between .NET Programs
I wanted to set up a simple data communication between two C# applications, and I'm not sure what the best method is in doing so. I've previously used Java Sockets and开发者_运维问答 ServerSockets to get the job done, but I'm new to C#, so I've come for advice :) It's going to be two way communication with two clients exchanging strings or something of the like.
WCF (Windows Communication Foundation) is what you want.
You have several options:
- Using pipes
- Using sockets
- WCF
You're needing .NET Remoting.
Remoting can be between two apps on the same computer, or across a network.
Here is a good start, the first link is a "Hello World!" remoting application: http://msdn.microsoft.com/en-us/library/kwdt6w2k%28VS.71%29.aspx
I would also take a look at NServiceBus. It's really easy to setup and provides you with a reliable messaging system. Any messages sent between the apps (whether the destination app is online or not) are always delivered. The library leverages MSMQ to facilitate communication.
精彩评论