ChannelServices provides for Channel registration, resolution, URL parsing and message sink creation. Activator.GetObject, RemotingServices.Unmarshal and RemotingServices.Connect utilize ChannelServices in resolving an object URL to setup client side infrastructure such as a proxy. The object URL passed to the registered channels to find a channel that can return a message. The message sink is used to deliver messages to the channel.
public class ChannelServices { public static IMessageCtrl AsyncDispatchMessage( IMessage msg, IMessageSink replySink); public static IChannel GetChannel (String name); public static IDictionary GetChannelSinkProperties(Object obj) public static String[] GetURLsforObject(MarshalByRefObject obj); public static void RegisterChannel (IChannel channel); public static IChannel[] RegisteredChannels {get;} public static IMessageSink ResolveChannelMessageSink(Object obj); public static void StartListening (String name, Object data); public static void StopListening (String name, Object data); public static IMessage SyncDispatchMessage(IMessage msg); public static void UnregisterChannel (IChannel channel); };
This method is used by the channel to dispatch the incoming messages to the server-side chain(s) based on the URI embedded in the message. The URI uniquely identifies the receiving object.
Perform a lookup using the channel name on the registered channels. Returns the channel.
Get the message sink dictionary of properties for a given proxy.
Return an array of all the URLs for an object.
Registers a channel. Takes in the IChannel interface from a Channel object.
Throws ArgumentNullException if channel parameter is null.
Throws RemotingException if channel already registered.
Returns an array of the currently registered channels.
Find the channel message sink associated with a given proxy.
Instructs a particular channel to start listening for requests. The data object can be used to pass specific initialization state to the channel.
Instruct a particular channel to stop listening for requests. The data object can be used to pass specific initialization state to the channel.
This method is used by the channel to dispatch the incoming messages to the server-side chain(s) based on the URI embedded in the message. The URI uniquely identifies the receiving object.
Unregister a paricular channel from the registered channels list.
Throws ArgumentNullException if channel parameter is null.
Throws RemotingException if channel is not registered.
public interface IChannel { public int ChannelPriority {get; } public String ChannelName {get; } public String MimeType {get; set; } }
Returns the name of the channel.
This read-only property returns the priority of the channel.
This read-write property sets or returns the mime type of the channel.
The sending side of channels must expose the IChannelSender interface.
public interface IChannelSender : IChannel { IMessageSink CreateMessageSink( String url, Object data, out String objectURI); }
The Channel returns a channel message sink, that delivers messages to the specified URL or channel data object. The completed String URL or the Object state can be NULL. Both cannot be NULL.
A message Sink is returned. Consumes the channel specific portion of the URI and returns the rest of the URI. The channel must return an objectURI. If objectURI is null the complete url is used for the objectURI.
The receiving side of channels must expose the IChannelReceiver interface.
public interface IChannelReceiver : IChannel { public Object ChannelData {get; } public String[] GetURLsforURI(String objectURI); public void StartListening(Object data); public void StopListening(Object data); }
This read-only property returns the channel specific data. Used when Marshal is called and an ObjRef is created.
Return an array of all the URLs for a URI. Called by ChannelServices. GetURLsforObject.
Instruct a particular channel to start listening for requests. The data object can be used to pass specific initialization state to the channel.
Instruct a particular channel to stop listening for requests. The data object can be used to pass specific state to the channel.