This documentation is archived and is not being maintained.

IClientChannelSink Interface

Provides required functions and properties for client channel sinks.

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

<ComVisibleAttribute(True)> _
Public Interface IClientChannelSink
	Inherits IChannelSinkBase
Dim instance As IClientChannelSink

/** @attribute ComVisibleAttribute(true) */ 
public interface IClientChannelSink extends IChannelSinkBase
public interface IClientChannelSink extends IChannelSinkBase

Channel sinks provide a plug-in point that allows access to the underlying messages flowing through the channel as well as the stream used by the transport mechanism to send messages to a remote object. Channel sinks are linked together in a chain of channel sink providers and all channel messages flow through this chain of sinks before they are serialized and transported.

The following code example illustrates an implementation of the IClientChannelSink interface.

No code example is currently available or this language may not be supported.
import System.*;
import System.Collections.*;
import System.IO.*;
import System.Runtime.Remoting.Channels.*;
import System.Runtime.Remoting.Messaging.*;
import System.Security.Permissions.*;

/** @attribute SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)
public class ClientSink extends BaseChannelSinkWithProperties
    implements IClientChannelSink
    // This class inherits from BaseChannelSinkWithPropertes
    // to get an implementation of IChannelSinkBase.
    // The next sink in the chain.
    private IClientChannelSink nextSink;

    /** @property 
    public IClientChannelSink get_NextChannelSink()
        return nextSink;

    public Stream GetRequestStream(IMessage message, 
        ITransportHeaders requestHeaders)
        // Get the request stream from the next sink in the chain.
        return nextSink.GetRequestStream(message, requestHeaders);
    } //GetRequestStream

    public void ProcessMessage(IMessage message, ITransportHeaders requestHeaders, 
        Stream requestStream, /** @ref */ ITransportHeaders responseHeaders,
        /** @ref */ Stream responseStream)
        // Print the request message properties.
        Console.WriteLine("---- Message from the client ----");
        IDictionary dictionary = message.get_Properties();
        Object key = null;
        IEnumerator objEnum = dictionary.get_Keys().GetEnumerator();
        while (objEnum.MoveNext()) {
            key = objEnum.get_Current();
            Console.WriteLine("{0} = {1}", key, dictionary.get_Item(key));
        // Hand off to the next sink in the chain.
        nextSink.ProcessMessage(message, requestHeaders, requestStream,
            responseHeaders, responseStream);
    } //ProcessMessage

    // For synchronous remoting, it is not necessary to implement this method.
    public void AsyncProcessRequest(IClientChannelSinkStack sinkStack,
        IMessage message, ITransportHeaders requestHeaders, Stream requestStream)
        throws NotImplementedException
        throw new NotImplementedException();
    } //AsyncProcessRequest

    public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, 
        Object state, ITransportHeaders responseHeaders, Stream responseStream) 
        throws  NotImplementedException
        throw new NotImplementedException();
    } //AsyncProcessResponse

    // Constructor
    public ClientSink(IClientChannelSink sink)
        if (sink == null) {
            throw new ArgumentNullException("sink");
        nextSink = sink;
    } //ClientSink
} //ClientSink

See the IClientChannelSinkProvider interface documentation for an example of the corresponding client sink provider 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