IClientChannelSink 인터페이스

정의

클라이언트 채널 싱크에 필요한 함수와 속성을 제공합니다.

public interface class IClientChannelSink : System::Runtime::Remoting::Channels::IChannelSinkBase
public interface IClientChannelSink : System.Runtime.Remoting.Channels.IChannelSinkBase
[System.Runtime.InteropServices.ComVisible(true)]
public interface IClientChannelSink : System.Runtime.Remoting.Channels.IChannelSinkBase
type IClientChannelSink = interface
    interface IChannelSinkBase
[<System.Runtime.InteropServices.ComVisible(true)>]
type IClientChannelSink = interface
    interface IChannelSinkBase
Public Interface IClientChannelSink
Implements IChannelSinkBase
파생
특성
구현

예제

다음 코드 예제 구현의 IClientChannelSink 인터페이스입니다.

using namespace System::Runtime::InteropServices;
using namespace System;
using namespace System::Collections;
using namespace System::IO;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Messaging;

[System::Security::Permissions::PermissionSet(System::Security::
   Permissions::SecurityAction::Demand, Name = "FullTrust")]
public ref class ClientSink: public BaseChannelSinkWithProperties, public IClientChannelSink
{
private:

   // This class inherits from BaseChannelSinkWithPropertes
   // to get an implementation of IChannelSinkBase.
   // The next sink in the chain.
   IClientChannelSink^ nextSink;


public:
   property IClientChannelSink^ NextChannelSink 
   {
      virtual IClientChannelSink^ get()
      {
         return (nextSink);
      }
   }

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

   virtual void ProcessMessage( IMessage^ message, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream )
   {
      // Print the request message properties.
      Console::WriteLine( "---- Message from the client ----" );
      IDictionary^ dictionary = message->Properties;
      IEnumerator^ myEnum = dictionary->Keys->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         Object^ key = safe_cast<Object^>(myEnum->Current);
         Console::WriteLine( "{0} = {1}", key, dictionary[ key ] );
      }

      Console::WriteLine( "---------------------------------" );

      // Hand off to the next sink in the chain.
      nextSink->ProcessMessage( message, requestHeaders, requestStream, responseHeaders, responseStream );
   }

   // For synchronous remoting, it is not necessary to implement this method.
   virtual void AsyncProcessRequest( IClientChannelSinkStack^ /*sinkStack*/, IMessage^ /*message*/, ITransportHeaders^ /*requestHeaders*/, Stream^ /*requestStream*/ )
   {
      throw gcnew NotImplementedException;
   }

   virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, ITransportHeaders^ /*responseHeaders*/, Stream^ /*responseStream*/ )
   {
      throw gcnew NotImplementedException;
   }

   property System::Collections::IDictionary^ Properties 
   {
      virtual System::Collections::IDictionary^ get() override
      {
         return (dynamic_cast<BaseChannelSinkWithProperties^>(this))->Properties;
      }
   }

   // Constructor
   ClientSink( IClientChannelSink^ sink )
   {
      if ( sink == nullptr )
            throw gcnew ArgumentNullException( "sink" );

      nextSink = sink;
   }
};
using System;
using System.Collections;
using System.IO;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;

public class ClientSink : BaseChannelSinkWithProperties, IClientChannelSink
{

    // This class inherits from BaseChannelSinkWithPropertes
    // to get an implementation of IChannelSinkBase.

    // The next sink in the chain.
    private IClientChannelSink nextSink;

    public IClientChannelSink NextChannelSink
    {
        get
        {
            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) );
    }

    public void ProcessMessage (IMessage message,
                                ITransportHeaders requestHeaders,
                                Stream requestStream,
                                out ITransportHeaders responseHeaders,
                                out Stream responseStream)
    {
        // Print the request message properties.
        Console.WriteLine("---- Message from the client ----");
        IDictionary dictionary = message.Properties;
        foreach (Object key in dictionary.Keys)
        {
            Console.WriteLine("{0} = {1}", key, dictionary[key]);
        }
        Console.WriteLine("---------------------------------");

        // Hand off to the next sink in the chain.
        nextSink.ProcessMessage(message, requestHeaders, requestStream, out responseHeaders, out responseStream);
    }

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

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

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

참조 된 IClientChannelSinkProvider 인터페이스 구현의 예제는 해당 클라이언트 싱크 공급자에 대 한 설명서입니다.

설명

채널 싱크는 채널 뿐만 아니라 원격 개체에 메시지를 보내는 데 전송 메커니즘을 통해 스트림을 통해 전송 되는 기본 메시지에 대 한 액세스를 허용 하는 플러그 인 지점을 제공 합니다. 채널 싱크는 채널 싱크 공급자 체인에 함께 연결 하 고 serialize 되 고 전송 하기 전에 모든 채널 싱크이 체인을 통해 메시지 흐름입니다.

속성

NextChannelSink

클라이언트 싱크 체인에 있는 다음 클라이언트 채널 싱크를 가져옵니다.

Properties

싱크의 속성에 액세스할 수 있도록 하는 사전을 가져옵니다.

(다음에서 상속됨 IChannelSinkBase)

메서드

AsyncProcessRequest(IClientChannelSinkStack, IMessage, ITransportHeaders, Stream)

현재 싱크에서 메서드 호출을 비동기식으로 처리하도록 요청합니다.

AsyncProcessResponse(IClientResponseChannelSinkStack, Object, ITransportHeaders, Stream)

현재 싱크에서 메서드 호출에 대한 응답을 비동기적으로 처리하도록 요청합니다.

GetRequestStream(IMessage, ITransportHeaders)

제공된 메시지가 serialize될 Stream을 반환합니다.

ProcessMessage(IMessage, ITransportHeaders, Stream, ITransportHeaders, Stream)

현재 싱크에서 메시지 처리를 요청합니다.

적용 대상

추가 정보