Article : .NET Remoting ( Part - 2 Channels )
Reply
![]() |
|
|
From:
Nasha
|
Hi Frndz, Sorry for disappearing for a couple of days in between. I am continuing the discussion on .NET Remoting starting with channels today :- Channels : Channels are used for communication. In .Net Remoting Channels are used to transport messages from client to server to and fro. When a message is sent from client to server, client is the sender and server is the receiver and vice-versa. Since channel is used to transport messages before starting any type of communication with the remote object it is important to setup a channel for communication.
To create a channel one needs to implement IChannel interface ( the primary interface for any channel). The two main operations of channels are to send and receive messages. For any channel to receive messages it needs to implement IChannelReceiver interface and to send messages it needs to implement IChannelSender Interface.
.NET Framework provides us with two in built channels TCP and HTTP. Both TCP and HTTP implement IChannelReceiver and IChannelSender interfaces.
Since all the channels implement IChannel interface let us check it out first. IChannel has two main properties ChannelName and ChannelPriority. ChannelName enables us to give a a reference name to the channel. ChannelPriority enables us set the priority.Channels with higher priority value are given higher priority.
TCP and HTTP channels, each are further classified into Client and Server channels. Client channels implement IChannelSender interface and Server channels implement IChannelReceiver interfaces respectively.
IChannelSender :- This interface is implemented by any channel to send messages. This interface has an important fuction called as CreateMessageSink. This method takes 3 parameters URL,remotechanneldata and objectURI and returns a reference to the newly created message sink. URL is the address to which the messages are to be delivered.Remotechanneldata holds the data about the target channel [ server channel ].ObjectURI is parameter is unintialized. When we call CreateMessageSink either URL or RemoteChannelData can be null but not both.
IChannelReceiver :- This interface is implemented by any channel to receive messages. It has an important property called ChannelData and 3 functions called GetUrlsforUri, StartListening and Stop Listening. ChannelData is a readonly property which returns an object containing channel specific data. GetUrlsforURI will return all the urls of that can be used to locate the remote object. Server channels implement IChannelSender to receive messages from the client. StartListening and StopListening helps the server channels to start or stop listening to its corresponding cleint channel.
Let us look at the the channels which implement the above interfaces:
TCPClientChannel :- Uses binary formatter to serialize messages. This channel is the last in the sink heirarchy who is responsible for finally sending out the message across to the server using TCP Protocol. TcpCleintChannel implements IChannelSender interface.
TCPServerChannel :- This channel works in conjunction with the client channel. Binary formatted messages sent by the client channel are accepted by the server channel. Unlike the Client Channel, the server channel is the first in the message sink heirarchy from the server side to receive messages. TcpServerChannel implements IChannelReceiver interaface.
TCPChannel :- This channel implements both IChannelSender and IChannelReceiver interfaces that enables it to both send and receive messages.
HTTPClientChannel :- Uses SOAP formatter to serialize messages to xml format. Like the TCPClientChannel is last the sink heirarchy and implements IChannelSender interface. This channel uses HTTP protocol to transport xml messages.
HTTPServerChannel :- Like the TcpServerchannel it also works in conjunction with the client channel to receive messages using HTTP protocol and is first in the sink heirarchy on the server side.
HTTPChannel : Implements both IChannelSender and IChannelReceiver that enables it to send and recieve messages using HTTP.
Note :- All HTTP Channels inherit from a common base class called BaseChannelWithProperties which in turn inherits from BaseChannelObjectWithProperties. They aid in reteriving properties of any channel sink in the sink heirarchy.
This is all about channels will continue tomm with sinks and formatters. -- Please post your queries and comments for my articles in the user group for the benefit of all. I hope this step from my end is helpful to all of us. You can find all articles written by me at my personal blog http://spaces.msn.com/members/nasha.
Regards,
Namratha (Nasha) |
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|