This documentation is archived and is not being maintained.

IChannelSender Interface

Provides required functions and properties for the sender channels.

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

[ComVisibleAttribute(true)]
public interface class IChannelSender : IChannel

The IChannelSender type exposes the following members.

  NameDescription
Public propertyChannelNameGets the name of the channel. (Inherited from IChannel.)
Public propertyChannelPriorityGets the priority of the channel. (Inherited from IChannel.)
Top

  NameDescription
Public methodCreateMessageSinkReturns a channel message sink that delivers messages to the specified URL or channel data object.
Public methodParseReturns the object URI as an out parameter, and the URI of the current channel as the return value. (Inherited from IChannel.)
Top

The sending side of channels must expose the IChannelSender interface.


#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <IChannelSender_Share.dll>

using namespace System;
using namespace System::Collections;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Messaging;
using namespace System::Runtime::Remoting::Channels::Http;
int main()
{
   try
   {

      // Create the 'IDictionary' to set the server object properties.
      IDictionary^ myDictionary = gcnew Hashtable;
      myDictionary->default[ "name" ] = "HttpClientChannel";
      myDictionary->default[ "priority" ] = 2;

      // Set the properties along with the constructor.
      IChannelSender^ myIChannelSender = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider );

      // Register the server channel.
      ChannelServices::RegisterChannel( myIChannelSender, false );
	  MyHelloServer ^ myHelloServer1 = dynamic_cast<MyHelloServer^>(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" ));
      if ( myHelloServer1 == nullptr )
      {
         Console::WriteLine( "Could not locate server" );
      }
      else
      {
         Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) );

         // Get the name of the channel.
         Console::WriteLine( "Channel Name :{0}", myIChannelSender->ChannelName );

         // Get the channel priority.
         Console::WriteLine( "ChannelPriority :{0}", myIChannelSender->ChannelPriority );
         String^ myString;
         String^ myObjectURI1;
         Console::WriteLine( "Parse :{0}{1}", myIChannelSender->Parse( "http://localhost:8085/SayHello",  myString ), myString );

         // Get the channel message sink that delivers message to specified url.
         IMessageSink^ myIMessageSink = myIChannelSender->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr,  myObjectURI1 );
         Console::WriteLine( "Channel message sink used :{0}", myIMessageSink );

         Console::WriteLine( "URI of new channel message sink :{0}", myObjectURI1 );
      }
   }
   catch ( Exception^ ex ) 
   {
      Console::WriteLine( "Following exception is raised on client side : {0}", ex->Message );
   }

}



.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: