System.Runtime.Remoting.Channels.IChannelReceiverHook Interface

Assembly: Mscorlib.dll
Namespace: System.Runtime.Remoting.Channels
Summary
Indicates that the implementing channel wants to hook into the outside listener service.
C# Syntax:
public interface IChannelReceiverHook
See also:
System.Runtime.Remoting.Channels Namespace

System.Runtime.Remoting.Channels.IChannelReceiverHook Member List:

Public Properties
ChannelScheme Read-only

ChannelSinkChain Read-only

Gets the channel sink chain that the current channel is using.
WantsToListen Read-only

Gets a Boolean value indicating whether IChannelReceiverHook needs to be hooked into the outside listener service.
Public Methods
AddHookChannelUri Adds a URI on which the channel hook will listen.

System.Runtime.Remoting.Channels.IChannelReceiverHook Member Details

Property: ChannelScheme (read-only)
Summary
Gets the type of listener to hook into.
C# Syntax:
string ChannelScheme {get;}
Remarks
This value is not case-sensitive.

Return to top


Property: ChannelSinkChain (read-only)
Summary
Gets the channel sink chain that the current channel is using.
C# Syntax:
IServerChannelSink ChannelSinkChain {get;}
Example
class CustomChannel : BaseChannelWithProperties, IChannelReceiverHook,
   IChannelReceiver, IChannel, IChannelSender {

   // TransportSink is a private class defined within CustomChannel.
   TransportSink transportSink;

   public IServerChannelSink ChannelSinkChain {
      get { return transportSink.NextChannelSink; }
   }

   // Rest of CustomChannel's implementation...

    

Return to top


Property: WantsToListen (read-only)
Summary
Gets a Boolean value indicating whether IChannelReceiverHook needs to be hooked into the outside listener service.
C# Syntax:
bool WantsToListen {get;}

Return to top


Method: AddHookChannelUri(
   string channelUri
)
Summary
Adds a URI on which the channel hook will listen.
C# Syntax:
void AddHookChannelUri(
   string channelUri
);
Parameters:

channelUri

A URI on which the channel hook will listen.

Remarks


Note Client code should not call this method directly.
Example
   class CustomChannel : BaseChannelWithProperties, IChannelReceiverHook,
                         IChannelReceiver, IChannel, IChannelSender {

      public void AddHookChannelUri(string channelUri) {

         if (channelUri != null) {
            string [] uris = dataStore.ChannelUris;
				
            // This implementation only allows one URI to be hooked in.
            if (uris == null) {
               string [] newUris = new string[1];
               newUris[0] = channelUri;
               dataStore.ChannelUris = newUris;
               wantsToListen = false;
            } else {
               string msg = "This channel is already listening for " +
                  "data, and can't be hooked into at this stage.";
               throw new System.Runtime.Remoting.RemotingException(msg);
            }
         }
      }
      // The rest of CustomChannel's implementation.

    

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.