IClientChannelSink インターフェイス
アセンブリ: mscorlib (mscorlib.dll 内)


チャネル シンクは、そのチャネルを流れている基になるメッセージにアクセスできるようにするプラグイン ポイント、およびリモート オブジェクトにメッセージを送信するために転送機構が使用するストリームを提供します。チャネル シンクは互いにリンクされてチャネル シンク プロバイダのチェインとなり、すべてのチャネル メッセージはこのシンク チェインを流れた後で、シリアル化されて転送されます。

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 インターフェイスのドキュメントを参照してください。

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


IClientChannelSink プロパティ
IClientChannelSink メソッド

名前 | 説明 | |
---|---|---|
![]() | AsyncProcessRequest | 現在のシンク上でメソッドの呼び出しの非同期処理を要求します。 |
![]() | AsyncProcessResponse | 現在のシンク上でメソッドの呼び出しへの応答の非同期処理を要求します。 |
![]() | GetRequestStream | 指定したメッセージがシリアル化される対象の Stream を返します。 |
![]() | ProcessMessage | 現在のシンクからのメッセージ処理を要求します。 |

IClientChannelSink メンバ
クライアント チャネル シンクに必要な関数およびプロパティを提供します。
IClientChannelSink データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | AsyncProcessRequest | 現在のシンク上でメソッドの呼び出しの非同期処理を要求します。 |
![]() | AsyncProcessResponse | 現在のシンク上でメソッドの呼び出しへの応答の非同期処理を要求します。 |
![]() | GetRequestStream | 指定したメッセージがシリアル化される対象の Stream を返します。 |
![]() | ProcessMessage | 現在のシンクからのメッセージ処理を要求します。 |

- IClientChannelSinkのページへのリンク