IChannelSender Interface


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Provides required functions and properties for the sender channels.

Namespace:   System.Runtime.Remoting.Channels
Assembly:  mscorlib (in mscorlib.dll)

public interface IChannelSender : IChannel


Gets the name of the channel.(Inherited from IChannel.)


Gets the priority of the channel.(Inherited from IChannel.)

System_CAPS_pubmethodCreateMessageSink(String, Object, String)

Returns a channel message sink that delivers messages to the specified URL or channel data object.

System_CAPS_pubmethodParse(String, String)

Returns the object URI as an out parameter, and the URI of the current channel as the return value.(Inherited from IChannel.)

The sending side of channels must expose the IChannelSender interface.

using System;
using System.Collections;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Channels.Http;
using System.Security.Permissions;

public class MyClient
   public static void Main()
         // Create the 'IDictionary' to set the server object properties.
         IDictionary myDictionary = new Hashtable();
         myDictionary["name"] = "HttpClientChannel";
         myDictionary["priority"] = 2;
         // Set the properties along with the constructor.
         IChannelSender myIChannelSender = new HttpClientChannel(myDictionary,
                                    new BinaryClientFormatterSinkProvider());
         // Register the server channel.
         MyHelloServer myHelloServer1 = (MyHelloServer)Activator.GetObject(
                  typeof(MyHelloServer), "http://localhost:8085/SayHello");
         if (myHelloServer1 == null)
            Console.WriteLine("Could not locate server");
            // Get the name of the channel.
            Console.WriteLine("Channel Name :" + myIChannelSender.ChannelName);
            // Get the channel priority.
            Console.WriteLine("ChannelPriority :" + 
            string myString,myObjectURI1;
            Console.WriteLine("Parse :" + 
                myIChannelSender.Parse("http://localhost:8085/SayHello",out myString)
                + myString);
            // Get the channel message sink that delivers message to specified url.
            IMessageSink myIMessageSink = 
                  "http://localhost:8085/NewEndPoint", null,out myObjectURI1);
            Console.WriteLine("Channel message sink used :" + myIMessageSink.ToString());
            Console.WriteLine("URI of new channel message sink :" + myObjectURI1);
      catch(Exception ex)
         Console.WriteLine("Following exception is raised on client side : " + ex.Message);

.NET Framework
Available since 1.1
Return to top