views:

741

answers:

3

Hi.

I have two C# programs and I want to send some data back and forth between them. (And check if the data arrived to the other application.) The two programs will always run on the same computer, so no networking capability is required. I've already read some questions with similar topics here, but I'm not entirely sure which is the right method for me. (WCF, Remoting, etc.)

What I want to know, is which one is the easier to implement for a beginner in C#? (I don't want it to get too complicated anyway, it's only a few integers and some text that I want to send.)

If there isn't a real difference in difficulty, what advantages does one have over the other?

I'd really appreciate some simple example code as well.

Thanks in advance.

+7  A: 

WCF essentially packages up the various methods of communication between applications (web services, remoting, MSMQ etc) in a single package, so that they are programmatically the same in the way that they are used, and the detail of what method is used is left for configuration of the binding between. A slight simplification perhaps, but essentially what it's about.

It is worth getting into WCF if you need inter-process communication, and this would certainly be my advice as to the way to go with this. It's worth looking at IDesign, who produce a number of articles on the subject, as well as some reusable code libraries, that you may find useful. Their Juval Lowy has also written an excellent book on the subject,

David M
Thanks for the quick summary and the links, it really helped to get a good overview of WCF.
Miklós
+3  A: 

You can use Pipes to send data between different instances of your application. If you just need to tell the other instance that something has happened you can send messages from one application to another by using SendMessage api.

Giorgi
Best suggestion, simple and reliable. Forget WCF, it's ridiculously over-engineered.
dpurrington
+4  A: 

Another good point about WCF is that if your requirements ever change and all of a sudden you have to move one of the application to a different machine, requiring now network capability, you will only need to change configuration on both sides, instead of having to recode.

Plus, ad David said, WCF is a good tool to have in your bag.

Cheers, Wagner.

Wagner Silveira