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を参照してください。

注釈

Important

信頼されていないデータを使用してこのクラスからメソッドを呼び出すことは、セキュリティ上のリスクです。 このクラスのメソッドは、信頼できるデータでのみ呼び出します。 詳細については、「すべての入力を検証する」を参照してください。

チャネルは、リモート呼び出しを転送するために.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)

適用対象