IpcClientChannel クラス

定義

IPC プロトコルを使用してメッセージを送信するリモート呼び出しのクライアント チャネルを実装します。

public ref class IpcClientChannel : System::Runtime::Remoting::Channels::IChannelSender, System::Runtime::Remoting::Channels::ISecurableChannel
public class IpcClientChannel : System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel
type IpcClientChannel = class
    interface IChannelSender
    interface IChannel
    interface ISecurableChannel
Public Class IpcClientChannel
Implements IChannelSender, ISecurableChannel
継承
IpcClientChannel
実装

IpcClientChannel クラスを使用するコード例を次に示します。

#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <Counter.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Ipc;

public ref class Client
{
public:
   void ClientTest()
   {
      IpcClientChannel^ clientChannel = gcnew IpcClientChannel;
      ChannelServices::RegisterChannel( clientChannel );

      RemotingConfiguration::RegisterWellKnownClientType( Counter::typeid, L"ipc://remote/counter" );
      Counter^ counter = gcnew Counter;
      Console::WriteLine( L"This is call number {0}.", counter->Count );
   }
};

int main()
{
   Client^ c = gcnew Client;
   c->ClientTest();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;

public class Client
{
    public static void Main ()
    {
        IpcClientChannel clientChannel = new IpcClientChannel();
        ChannelServices.RegisterChannel(clientChannel);

        RemotingConfiguration.RegisterWellKnownClientType( typeof(Counter) , "ipc://remote/counter" );

        Counter counter = new Counter();
        Console.WriteLine("This is call number {0}.", counter.Count);
    }
}

上記のコードでは、次のリモート オブジェクトを使用します。

using namespace System;
public ref class Counter: public MarshalByRefObject
{
private:
   int count;

public:
   Counter()
   {
      count = 0;
   }

   property int Count 
   {
      int get()
      {
         return (count)++;
      }
   }
};
using System;

public class Counter : MarshalByRefObject {

  private int count = 0;

  public int Count { get {
    return(count++);
  } }
}

このオブジェクトをリモートで公開するサーバーの例については、次を参照してください IpcServerChannel

注釈

重要

このクラスのメソッドを信頼されていないデータを指定して呼び出すことには、セキュリティ上のリスクが伴います。 このクラスのメソッドの呼び出しは、信頼されたデータだけを指定して実行してください。 詳細については、「 すべての入力の検証」を参照してください。

チャネルは、the.NET Framework リモート処理インフラストラクチャによってリモート呼び出しを転送するために使用されます。 クライアントがリモート オブジェクトを呼び出すと、その呼び出しは、クライアント チャネルによって送信され、サーバー チャネルによって受信されるメッセージにシリアル化されます。 メッセージを受信すると、メッセージは逆シリアル化され、処理されます。 返された値はすべて、サーバー チャネルによって送信され、クライアント チャネルによって受信されます。

クラスはIpcClientChannel、Windowsプロセス間通信 (IPC) システムを使用して、同じコンピューター上のアプリケーション ドメイン間でメッセージを転送します。 同じコンピューター上のアプリケーション ドメイン間で通信する場合、IPC チャネルは TCP または HTTP チャネルよりもはるかに高速です。

クライアント側でメッセージの追加処理を実行するには、オブジェクトによって処理されるすべてのメッセージが渡されるインターフェイスの IClientChannelSinkProvider 実装を IpcClientChannel 指定できます。

既定では、クラスは IpcClientChannel バイナリ フォーマッタを使用してすべてのメッセージをシリアル化します。

IpcClientChannelオブジェクトに関連付けられた構成プロパティがあり、構成ファイル (静的RemotingConfiguration.Configureメソッドを呼び出すことによって) またはプログラムによって (コンストラクターにコレクションを渡IDictionaryすことによって) 実行時にIpcClientChannel設定できます。 これらの構成プロパティの一覧については、コンストラクターのドキュメントを IpcClientChannel 参照してください。

コンストラクター

IpcClientChannel()

IpcServerChannel クラスの新しいインスタンスを初期化します。

IpcClientChannel(IDictionary, IClientChannelSinkProvider)

構成プロパティとシンクを指定して、IpcClientChannel クラスの新しいインスタンスを初期化します。

IpcClientChannel(String, IClientChannelSinkProvider)

名前とシンクを指定して、IpcClientChannel クラスの新しいインスタンスを初期化します。

プロパティ

ChannelName

現在のチャネルの名前を取得します。

ChannelPriority

現在のチャネルの優先順位を取得します。

IsSecured

現在のチャネルをセキュリティで保護しているかどうかを示すブール値を取得または設定します。

メソッド

CreateMessageSink(String, Object, String)

指定した URL またはチャネル データ オブジェクトにメッセージを配信するチャネル メッセージ シンクを返します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Parse(String, String)

指定した URL からチャネル URI と既知のリモート オブジェクト URI を抽出します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象