.NET Remoting – Communicate between application


There are situation we need to communicate between application over network or in the same machine. There are several ways to implement the functionality. To communicate between application we have few options like .NEt Named Pipes, MSMQ, Enterprise services and Remoting.

Depends on the requirement we can select the communication option. In this blog i will discuss how to implement kind of chat application using .NET Remoting.

.NET Remoting Overview 

The .NET remoting infrastructure is an abstract approach to inter-process communication. Objects that can be passed by value, or copied, are automatically passed between applications in different application domains or on different computers. Mark your custom classes as serializable to make this work.

Can read more on Remoting here.

Sample Code

The sample application which i am posting here has 3 major component to it

  1. Remoting Server
  2. Remoting Client
  3. Remoting Library

Remoting Server:

The Remoting Server module will open the connection using Tcp Channel on the specified port. The server also can send message to multiple client which are connected to receive the message.

image

Server Application Exe

Remoting Client:

The Remoting client will try to connect to the server and respond back with the message.

image

Client Application Exe

Remoting Library:

Remoting Library will have the Remotable Type object with the Message Response and the Message Transfer class type. Both the class types are serializable

Full source is here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s