Understanding .Net Remoting

.NET Remoting enables us to communication between different applications regardless of whether they reside on the same computer or on different computers. These computers can be part of the same network or part of networks in different geographic locations across the world.

The .NET Remoting system transport messages to and from remote objects using communication channels. Communication channels are the objects that transport messages between the remote objects. Any message that is sent along a communication channel is encoded and decoded using native .NET serialization formatters, such as binary and SOAP. Serialization formatters are the objects that help you to encode and decode messages that are sent to or received from a remote object.

Two kinds of encoding are possible for all messages: binary and XML encoding. Applications in which performance is critical use binary encoding. In cases where interoperability with other remoting systems is essential, XML encoding is the preferred choice.

The .NET Remoting system enables you to perform communication between different objects in different application domains or processes using different transportation protocols, such as HTTP and TCP/IP; serialization formats, such as binary or SOAP; object lifetime schemes; and modes of object creation.

 

.Net Remoting Architecture

To communicate between server objects and clients in .NET Remoting, you need to use object references of the server object in the client application. When you create an instance of the remote object using the new keyword, your client receives a reference to the server object. After obtaining the object reference, the client can call methods on the server object as if the object resides in the client's process and does not run on a separate computer.

What is a Channel ?


Channels enable an application that is running in one application domain, process, or computer to send messages to an application running in a different application domain, process, or computer.

The .NET Framework provides the System.Runtime.Remoting.Channels name-space, which includes the interfaces and classes that you use to work with channels. All channels implement the IChannel interface. The IChannel interface provides properties such as ChannelName and ChannelPriority, which uniquely identify a channel and define the channel priority, respectively.

Depending on whether you use a channel to receive or send messages, channels are categorized as receiver or server and sender or client channels. A receiver or server channel implements the IChannelReceiver interface, and a sender or client channel implements the IChannelSender interface. The IChannelReceiver interface specifies methods, such as StartListening and StopListening, that must be implemented by a receiver channel class. The IChannelSender interface specifies a method, Create?MessageSink, which must be implemented by a sender or client channel class. The CreateMessageSink method creates and returns a message sink that the channel object uses to deliver messages to a remote object located at a specific URL.