tags:

views:

112

answers:

5

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.

A: 

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

Dave Swersky
.NET Remoting has been deprecated in favor of WCF. Please do not direct new people at .NET Remoting.
John Saunders
I'd have to take issue with the idea that .NET Remoting has been "deprecated" in favor of WCF. Does this mean Microsoft will no longer support my code if I'm using TCP or pipes? Hardly. Additionally, follow the link in my answer. If there was a question of deprecation, the content behind that link would say something to that effect. Microsoft may favor WCF over Remoting as a general rule, but that marketing issue does not make my answer incorrect.
Dave Swersky
@Dave: your link is the .NET 1.1 link. Please don't post those except in answer to .NET 1.1 questions. The current link is http://msdn.microsoft.com/en-us/library/kwdt6w2k.aspx, which says, "This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF). Link=http://go.microsoft.com/fwlink/?LinkID=127777"
John Saunders
+4  A: 

WCF (Windows Communication Foundation) is what you want.

Jaxidian
Remoting is one possible option within WCF but there are others as well without changing a single line of code, just a config file.
Jaxidian
A: 

I'd encourage you to check out this SO post that discusses WCF - I think that's the way to go.

itsmatt
+1  A: 

You have several options:

  1. Using pipes
  2. Using sockets
  3. WCF
Giorgi
FWIW, WCF gives #1 and #2 as an implementation option.
Jaxidian
A: 

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.

Rohland