Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IClientChannelSinkProvider Interface

Creates client channel sinks for the client channel through which remoting messages flow.

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

[ComVisibleAttribute(true)] 
public interface IClientChannelSinkProvider
/** @attribute ComVisibleAttribute(true) */ 
public interface IClientChannelSinkProvider
ComVisibleAttribute(true) 
public interface IClientChannelSinkProvider

Channel sinks are connected to a client channel through implementations of the IClientChannelSinkProvider interface. All the remoting client channels provide constructors that take a IClientChannelSinkProvider as a parameter.

Channel sink providers are stored in a chain, and the user is responsible for chaining all channel sink providers together before passing the outer one to the channel constructor. IClientChannelSinkProvider provides a property called Next for this purpose.

When multiple channel sink providers are specified in a configuration file, the remoting infrastructure will chain them together in the order they are found in the configuration file. The channel sink providers will be created when the channel is created during the RemotingConfiguration.Configure call.

The following code example illustrates an implementation of this interface.

public class ClientSinkProvider : IClientChannelSinkProvider
{

    // The next provider in the chain.
    private IClientChannelSinkProvider nextProvider;

    public IClientChannelSinkProvider Next
    {
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        get
        {
            return(nextProvider);
        }
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        set
        {
            nextProvider = value;
        }
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    public IClientChannelSink CreateSink (IChannelSender channel, String url, Object remoteChannelData)
    {

        Console.WriteLine("Creating ClientSink for {0}", url);

        // Create the next sink in the chain.
        IClientChannelSink nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);

        // Hook our sink up to it.
        return( new ClientSink(nextSink) );
    }

    // This constructor is required in order to use the provider in file-based configuration.
    // It need not do anything unless you want to use the information in the parameters.
    public ClientSinkProvider (IDictionary properties, ICollection providerData) {}
    
}

/** @attribute SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)
*/
public class ClientSinkProvider implements IClientChannelSinkProvider
{
    // The next provider in the chain.
    private IClientChannelSinkProvider nextProvider;

    /** @property 
     */
    public IClientChannelSinkProvider get_Next()
    {
        return nextProvider;
    }//get_Next

    /** @property
     */
    public void set_Next(IClientChannelSinkProvider value)
    {
        nextProvider = value;
    }//set_Next

    public IClientChannelSink CreateSink(IChannelSender channel, String url,
        Object remoteChannelData)
    {
        Console.WriteLine("Creating ClientSink for {0}", url);
        // Create the next sink in the chain.
        IClientChannelSink nextSink = nextProvider.CreateSink(channel, url,
            remoteChannelData);
        // Hook our sink up to it.
        return new ClientSink(nextSink);
    } //CreateSink

    // This constructor is required in order to use the provider in file-based 
    //configuration. It need not do anything unless you want to use the 
    // information in the parameters.
    public ClientSinkProvider(IDictionary properties, ICollection providerData)
    {
    } //ClientSinkProvider 
} //ClientSinkProvider

See the IClientChannelSink interface documentation for an example of the corresponding client sink implementation.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.