Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

About .NET Remoting and types of remoting ?

Answer Posted / mohan

Remoting allows two processes, a Server and a Client, to
communicate in the same system, the same network or across
networks. It allows applications in the same or different
domains to inter-communicate. This article discusses the
concept of Remoting in .NET with a simple example using C#.

Local and Remote Objects

In Remoting, a local object is one that is confined to the
same application domain in which it is created. The object
is considered Remote if it resides in a different
application domain and can be invoked remotely by abiding
by some pre-defined protocols. A Remote object inherits
from the class MarshalByRefObject.

Channels

Channels are used to establish communications between
a .NET Server and a .NET Client. Channels are a means of
message communication between a Server and a Client process
in .NET Remoting. Each channel is associated with a
specific port. The clients access the Remote objects using
channels. Channels can be of the following types:

· Http Channel

· Tcp Channel

Formatters

Formatters are responsible for encoding and decoding
messages that are transmitted between the server and the
client's application domains using these Channels. There
are two formatters:

· Binary Formatter

· SOAP Formatter

The respective formatter classes for the above formatters
are:

System.Runtime.Serialization.Formatters.Binary.BinaryFormatt
er

System.Runtime.Serialization.Formatters.Soap.SoapFormatter

Remoting in action

In .NET Remoting we have three components, a Server class
that extends the class MarshalByRefObject, a client class
and a proxy. The client does not call a server’s method
directly. Instead, it invokes the method on the proxy. The
client channel object actually sends a message to the
remote channel object. A formatter on the client’s
application domain then encodes the message and passes the
same through the transport channel onto the server’s
application domain. The message is decoded by a formatter
on the server’s application domain and then the appropriate
server’s method is called on the object being invoked.
After the method completes its execution, the results are
returned back to the client.

Passing Objects in Remoting

In Remoting, objects are passed from the server to the
client or vice-versa using a process known as Marshalling.
Marshalling can be of the following two types:

· Marshal by reference

· Marshal by value

In Marshall by reference, a proxy of the server’s object is
created in the client’s application domain. In Marshal by
value however, the server creates a copy of the remote
object and sends the same to the client. In order to
implement Marshal by reference, the class should extend the
class MarshalByRefObject. To implement Marshal by value
however, you should implement the ISerializable interface
or specify the keyword Serializable attribute when
declaring the class. Marshal by value classes are also
known as unbound classes and do not have a remote identity.
The MarshalByRefObjects are also known as application
domain-bound or context-bound objects.

Types of Remote Objects

The following are the types of Remote Objects:

· Client Activated

· Server Activated

A client-activated Remote Object is one which is
instantiated by a client and whose lifetime is determined
by a client. The object is alive as long as its services
are required by the client. A server-activated Remote
Object is one whose lifetime is determined by the remote
object. Activation modes of the Server Activated Remote
Objects can be of the following two types:

· Single Call Activation Mode

· Singleton Activation Mode

The Single Call Activation mode is stateless and can handle
only one client request at any time. For each request a new
object is created and after the request is serviced the
object is marked as garbage and it is subject to garbage
collection. The Singleton Activation mode is not stateless
so it can serve multiple clients.

Is This Answer Correct ?    20 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the ways to renew lifetime leases of objects?

1113


Explain the hierarchial description of remoting?

982


What is the proxy of the server object in .net remoting?

1049


What are the different types of channels used by .net remoting and which is the best one?

1025


Explain how to directly call a native function exported from a dll?

1042


what is Client-activated object in remoting?

1031


Explain Singleton design pattern of Remoting?

1023


What are the types of remoting?

1047


Explain how does assembly versioning in .net prevent dll hell?

1132


Explain how can you automatically generate interface for the remotable object in .net with microsoft tools?

1056


What does manifest consists?

995


Are you aware of containment and Aggregation ?

3227


What is the difference between remoting and webservice?

1027


What is fundamental of published or precreated objects in remoting?

1057


What are dynamic assemblies?

1054