IClientChannelSinkとは? わかりやすく解説

IClientChannelSink インターフェイス

クライアント チャネル シンク必要な関数およびプロパティ提供します

名前空間: System.Runtime.Remoting.Channels
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Interface IClientChannelSink
    Inherits IChannelSinkBase
Dim instance As IClientChannelSink
[ComVisibleAttribute(true)] 
public interface IClientChannelSink : IChannelSinkBase
[ComVisibleAttribute(true)] 
public interface class IClientChannelSink :
 IChannelSinkBase
/** @attribute ComVisibleAttribute(true) */ 
public interface IClientChannelSink extends IChannelSinkBase
ComVisibleAttribute(true) 
public interface IClientChannelSink extends
 IChannelSinkBase
解説解説
使用例使用例

IClientChannelSink インターフェイス実装を示すコード例次に示します

using System;
using System.Collections;
using System.IO;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;
using System.Security.Permissions;

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
    {
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        get
        {
            return(nextSink);
        }
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    public Stream GetRequestStream (IMessage message, ITransportHeaders
 requestHeaders)
    {
        // Get the request stream from the next sink in the chain.
        return( nextSink.GetRequestStream(message, requestHeaders)
 );
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    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.
    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    public void AsyncProcessRequest (IClientChannelSinkStack
 sinkStack,
                                     IMessage message,
                                     ITransportHeaders requestHeaders,
                                     Stream requestStream)
    {
        throw new NotImplementedException();
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    public void AsyncProcessResponse (IClientResponseChannelSinkStack
 sinkStack,
                                      Object state,
                                      ITransportHeaders responseHeaders,
                                      Stream responseStream)
    {
        throw new NotImplementedException();
    }


    // Constructor
    [SecurityPermission(SecurityAction.LinkDemand)]
    public ClientSink (IClientChannelSink sink) {
      if (sink == null) throw new
 ArgumentNullException("sink");
      nextSink = sink;
    }

}
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;
   }
};
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;
    }//get_NextChannelSink

    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));
        }
        Console.WriteLine("---------------------------------");
        // 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

対応するクライアント シンク プロバイダ実装例については、IClientChannelSinkProvider インターフェイスドキュメント参照してください

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IClientChannelSink プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

IClientChannelSink インターフェイス
System.Runtime.Remoting.Channels 名前空間

その他の技術情報

シンクシンク チェーン

IClientChannelSink メソッド


パブリック メソッドパブリック メソッド

参照参照

関連項目

IClientChannelSink インターフェイス
System.Runtime.Remoting.Channels 名前空間

その他の技術情報

シンクシンク チェーン

IClientChannelSink メンバ




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IClientChannelSink」の関連用語

IClientChannelSinkのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IClientChannelSinkのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS