IpcServerChannel クラス

定義

IPC システムを使用してメッセージを送信するリモート呼び出しのサーバー チャネルを実装します。

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

次のコード例は、 クラスの使用方法を IpcServerChannel 示しています。

#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 IpcServer
{
public:
   void IpcServerTest()
   {
      // Create and register an IPC channel
      IpcServerChannel^ serverChannel = gcnew IpcServerChannel( L"remote" );
      ChannelServices::RegisterChannel( serverChannel );

      // Expose an object
      RemotingConfiguration::RegisterWellKnownServiceType( Counter::typeid, L"counter", WellKnownObjectMode::Singleton );
      
      // Wait for calls
      Console::WriteLine( L"Listening on {0}", serverChannel->GetChannelUri() );

      Console::ReadLine();
   }
};

int main()
{
   IpcServer^ is = gcnew IpcServer;
   is->IpcServerTest();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;

public class IpcServer
{

    public static void Main ()
    {
        // Create and register an IPC channel
        IpcServerChannel serverChannel = new IpcServerChannel("remote");
        ChannelServices.RegisterChannel(serverChannel);

        // Expose an object
        RemotingConfiguration.RegisterWellKnownServiceType( typeof(Counter), "counter", WellKnownObjectMode.Singleton );

        // Wait for calls
        Console.WriteLine("Listening on {0}", serverChannel.GetChannelUri());
        Console.ReadLine();
    }
}

上記のコードは、次のリモート オブジェクトを公開するために使用されます。

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++);
  } }
}

このオブジェクトをリモートで使用するクライアントの例については、「」を参照してください IpcClientChannel

注釈

重要

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

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

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

サーバー側でメッセージの追加処理を実行するには、インスタンスによって処理されたすべてのメッセージが IServerChannelSinkProvider 渡されるインターフェイスの実装を IpcServerChannel 指定します。

インスタンスは IpcServerChannel 、バイナリ形式または SOAP 形式でシリアル化されたメッセージを受け入れます。

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

注意事項

引数で properties プロパティを exclusiveAddressUsefalse設定すると、同じ名前付きパイプに複数IpcServerChannelのオブジェクトを登録できます。 このような場合、要求は登録されている任意のチャネルに移動できます。 この設定は、ALC も使用されている場合にのみセキュリティで保護されたと見なされます。

コンストラクター

IpcServerChannel(IDictionary, IServerChannelSinkProvider)

チャネル プロパティとシンクを指定して、IpcServerChannel クラスの新しいインスタンスを初期化します。

IpcServerChannel(IDictionary, IServerChannelSinkProvider, CommonSecurityDescriptor)

チャネル プロパティ、シンク、およびセキュリティ記述子を指定して、IpcServerChannel クラスの新しいインスタンスを初期化します。

IpcServerChannel(String)

IPC ポート名を指定して IpcServerChannel クラスの新しいインスタンスを初期化します。

IpcServerChannel(String, String)

チャネル名と IPC ポート名を指定して、IpcServerChannel クラスの新しいインスタンスを初期化します。

IpcServerChannel(String, String, IServerChannelSinkProvider)

チャネル名、IPC ポート名、およびシンクを指定して、IpcServerChannel クラスの新しいインスタンスを初期化します。

プロパティ

ChannelData

チャネル固有のデータを取得します。

ChannelName

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

ChannelPriority

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

IsSecured

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

メソッド

Equals(Object)

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

(継承元 Object)
GetChannelUri()

現在のチャネルの URI を返します。

GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
GetUrlsForUri(String)

指定した URI を持つオブジェクトのすべての URL のうち、現在の IpcChannel インスタンスでホストされている URL の配列を返します。

MemberwiseClone()

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

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

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

StartListening(Object)

現在のチャネルに対して、要求の待機を開始するように指示します。

StopListening(Object)

現在のチャネルに対して、要求の待機を停止するように指示します。

ToString()

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

(継承元 Object)

適用対象