IPC channelとは? わかりやすく解説

IpcChannel クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

IPC プロトコル使用してメッセージ送信するチャネル実装提供します

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

Public Class IpcChannel
    Implements IChannelReceiver, IChannelSender, IChannel, ISecurableChannel
public class IpcChannel : IChannelReceiver,
 IChannelSender, IChannel, 
    ISecurableChannel
public ref class IpcChannel : IChannelReceiver,
 IChannelSender, IChannel, 
    ISecurableChannel
public class IpcChannel implements IChannelReceiver,
 IChannelSender, 
    IChannel, ISecurableChannel
public class IpcChannel implements IChannelReceiver,
 IChannelSender, 
    IChannel, ISecurableChannel
解説解説
使用例使用例

IpcChannel使用してリモート処理サーバーとそのクライアント設定する方法次のコード例示します。この例は、次の 3 つの部分構成されます。

サーバー次のコード例示します

using System;
using System.Runtime.Remoting.Channels.Ipc;
using System.Security.Permissions;

public class Server
{
[SecurityPermission(SecurityAction.Demand)]
    public static void Main(string[]
 args)
    {
        // Create the server channel.
        IpcChannel serverChannel = 
            new IpcChannel("localhost:9090"); 

        // Register the server channel.
        System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(
            serverChannel);

        // Show the name of the channel.
        Console.WriteLine("The name of the channel is {0}.", 
            serverChannel.ChannelName);

        // Show the priority of the channel.
        Console.WriteLine("The priority of the channel is {0}.", 
            serverChannel.ChannelPriority);

        // Show the URIs associated with the channel.
        System.Runtime.Remoting.Channels.ChannelDataStore channelData = 
            (System.Runtime.Remoting.Channels.ChannelDataStore) 
            serverChannel.ChannelData;
        foreach (string uri in
 channelData.ChannelUris)
        {
            Console.WriteLine("The channel URI is {0}.", uri);
        }

        // Expose an object for remote calls.
        System.Runtime.Remoting.RemotingConfiguration.
            RegisterWellKnownServiceType(
                typeof(RemoteObject), "RemoteObject.rem", 
                System.Runtime.Remoting.WellKnownObjectMode.Singleton);
    
        // Parse the channel's URI.
        string[] urls = serverChannel.GetUrlsForUri("RemoteObject.rem");
        if (urls.Length > 0)
        {
            string objectUrl = urls[0];
            string objectUri;
            string channelUri = serverChannel.Parse(objectUrl,
 out objectUri);
            Console.WriteLine("The object URI is {0}.", objectUri);
            Console.WriteLine("The channel URI is {0}.", channelUri);
            Console.WriteLine("The object URL is {0}.", objectUrl);
        }

        // Wait for the user prompt.
        Console.WriteLine("Press ENTER to exit the server.");
        Console.ReadLine();
        Console.WriteLine("The server is exiting.");
    }
}
#using <System.dll>
#using <System.Runtime.Remoting.dll>
#using "common.dll"
using namespace System;
using namespace System::Runtime::Remoting::Channels::Ipc;

void main()
{
   // Create the server channel.
   IpcChannel^ serverChannel = gcnew IpcChannel( L"localhost:9090" );

   // Register the server channel.
   System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel( serverChannel
 );

   // Show the name of the channel.
   Console::WriteLine( L"The name of the channel is {0}.", serverChannel->ChannelName
 );

   // Show the priority of the channel.
   Console::WriteLine( L"The priority of the channel is {0}.", serverChannel->ChannelPriority
 );

   // Show the URIs associated with the channel.
   System::Runtime::Remoting::Channels::ChannelDataStore^ channelData = (System::Runtime::Remoting::Channels::ChannelDataStore^)serverChannel->ChannelData;
   for each (String^ uri in channelData->ChannelUris)
   {
      Console::WriteLine("The channel URI is {0}.", uri);
   }
   
   // Expose an object for remote calls.
   System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownServiceType(
         RemoteObject::typeid,L"RemoteObject.rem",
         System::Runtime::Remoting::WellKnownObjectMode::Singleton);
   
   // Parse the channel's URI.
   array<String^>^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem"
 );
   if ( urls->Length > 0 )
   {
      String^ objectUrl = urls[ 0 ];
      String^ objectUri;
      String^ channelUri = serverChannel->Parse( objectUrl,  objectUri );
      Console::WriteLine( L"The object URI is {0}.", objectUri );
      Console::WriteLine( L"The channel URI is {0}.", channelUri );
      Console::WriteLine( L"The object URL is {0}.", objectUrl );
   }

   // Wait for the user prompt.
   Console::WriteLine( L"Press ENTER to exit the server." );
   Console::ReadLine();
   Console::WriteLine( L"The server is exiting." );
}

このサーバー対すクライアント次のコード例示します

using System;
using System.Runtime.Remoting.Channels.Ipc;
using System.Security.Permissions;

public class Client
{
[SecurityPermission(SecurityAction.Demand)]
    public static void Main(string[]
 args)
    {
        // Create the channel.
        IpcChannel channel = new IpcChannel();

        // Register the channel.
        System.Runtime.Remoting.Channels.ChannelServices.
            RegisterChannel(channel);

        // Register as client for remote object.
        System.Runtime.Remoting.WellKnownClientTypeEntry remoteType = 
            new System.Runtime.Remoting.WellKnownClientTypeEntry(
                typeof(RemoteObject),
                "ipc://localhost:9090/RemoteObject.rem");
        System.Runtime.Remoting.RemotingConfiguration.
            RegisterWellKnownClientType(remoteType);

        // Create a message sink.
        string objectUri;
        System.Runtime.Remoting.Messaging.IMessageSink messageSink =
            channel.CreateMessageSink(
                "ipc://localhost:9090/RemoteObject.rem", null
,
                out objectUri);
        Console.WriteLine("The URI of the message sink is {0}.",
            objectUri);
        if (messageSink != null)
        {
            Console.WriteLine("The type of the message sink is {0}.",
                messageSink.GetType().ToString());
        }

        // Create an instance of the remote object.
        RemoteObject service = new RemoteObject(); 

        // Invoke a method on the remote object.
        Console.WriteLine("The client is invoking the remote object.");
        Console.WriteLine("The remote object has been called {0} times."
,
            service.GetCount());
    }
}
#using <System.dll>
#using <System.Runtime.Remoting.dll>
#using "common.dll"
using namespace System;
using namespace System::Runtime::Remoting::Channels::Ipc;

void main()
{
   
   // Create the channel.
   IpcChannel^ channel = gcnew IpcChannel;
   
   // Register the channel.
   System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel(channel);
   
   // Register as client for remote object.
   System::Runtime::Remoting::WellKnownClientTypeEntry^ remoteType = gcnew
       System::Runtime::Remoting::WellKnownClientTypeEntry( 
         RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem"
 );
   System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownClientType(remoteType);
   
   // Create a message sink.
   String^ objectUri;
   System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = channel->CreateMessageSink(
      L"ipc://localhost:9090/RemoteObject.rem", nullptr, objectUri
 );
   Console::WriteLine( L"The URI of the message sink is {0}.", objectUri
 );
   if ( messageSink != nullptr )
   {
      Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType()
 );
   }

   
   // Create an instance of the remote object.
   RemoteObject^ service = gcnew RemoteObject;
   
   // Invoke a method on the remote object.
   Console::WriteLine( L"The client is invoking the remote object." );
   Console::WriteLine( L"The remote object has been called {0} times.",
 service->GetCount() );
}

サーバークライアントによって使用されるリモート オブジェクト次のコード例示します

using System;

// Remote object.
public class RemoteObject : MarshalByRefObject
{
    private int callCount = 0;

    public int GetCount()
    {
        Console.WriteLine("GetCount has been called.");
        callCount++;
        return(callCount);
    }
}
using namespace System;

// Remote object.
public ref class RemoteObject: public
 MarshalByRefObject
{
private:
   static int callCount = 0;

public:
   int GetCount()
   {
      Console::WriteLine( L"GetCount has been called." );
      callCount++;
      return (callCount);
   }

};

継承階層継承階層
System.Object
  System.Runtime.Remoting.Channels.Ipc.IpcChannel
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IpcChannel メンバ
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

サーバー チャネル除きクライアント チャネルだけをアクティブにして、IpcChannel クラス新しインスタンス初期化します。

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

public IpcChannel ()
public:
IpcChannel ()
public IpcChannel ()
使用例使用例

このコンストラクタ使用するコードの例次に示します。このコード例は、IpcChannel クラストピック取り上げているコード例一部分です。

// Create the channel.
IpcChannel channel = new IpcChannel();
// Create the channel.
IpcChannel^ channel = gcnew IpcChannel;

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IpcChannel クラス
IpcChannel メンバ
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel コンストラクタ (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

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

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

Public Sub New ( _
    properties As IDictionary, _
    clientSinkProvider As IClientChannelSinkProvider, _
    serverSinkProvider As IServerChannelSinkProvider _
)
Dim properties As IDictionary
Dim clientSinkProvider As IClientChannelSinkProvider
Dim serverSinkProvider As IServerChannelSinkProvider

Dim instance As New IpcChannel(properties,
 clientSinkProvider, serverSinkProvider)
public IpcChannel (
    IDictionary properties,
    IClientChannelSinkProvider clientSinkProvider,
    IServerChannelSinkProvider serverSinkProvider
)
public:
IpcChannel (
    IDictionary^ properties, 
    IClientChannelSinkProvider^ clientSinkProvider, 
    IServerChannelSinkProvider^ serverSinkProvider
)
public IpcChannel (
    IDictionary properties, 
    IClientChannelSinkProvider clientSinkProvider, 
    IServerChannelSinkProvider serverSinkProvider
)
public function IpcChannel (
    properties : IDictionary, 
    clientSinkProvider : IClientChannelSinkProvider, 
    serverSinkProvider : IServerChannelSinkProvider
)

パラメータ

properties

クライアント チャネルサーバー チャネル使用される構成プロパティの値を指定する IDictionary コレクション

clientSinkProvider

クライアント チャネルによって使用される IClientChannelSinkProvider の実装

serverSinkProvider

サーバー チャネルによって使用される IServerChannelSinkProvider の実装

解説解説
使用例使用例

このコンストラクタ使用するコードの例次に示します。このコード例は、IpcChannel クラストピック取り上げているコード例一部分です。

// Create the server channel.
System.Collections.IDictionary properties = 
    new System.Collections.Hashtable();
properties["name"] = "ipc";
properties["priority"] = "20";
properties["portName"] = "localhost:9090";
IpcChannel serverChannel = new IpcChannel(properties, null,
 null); 
// Create the server channel.
System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable;
properties->default[ L"name" ] = L"ipc";
properties->default[ L"priority" ] = L"20";
properties->default[ L"portName" ] = L"localhost:9090";
IpcChannel^ serverChannel = gcnew IpcChannel( properties,nullptr,nullptr );

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

IpcChannel コンストラクタ

IpcChannel クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

IpcChannel クラス
IpcChannel メンバ
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定した IPC ポート待機するサーバー チャネル使用して IpcChannel クラス新しインスタンス初期化します。

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

Public Sub New ( _
    portName As String _
)
Dim portName As String

Dim instance As New IpcChannel(portName)
public IpcChannel (
    string portName
)
public:
IpcChannel (
    String^ portName
)
public IpcChannel (
    String portName
)
public function IpcChannel (
    portName : String
)

パラメータ

portName

IPC ポートの名前。

使用例使用例

このコンストラクタ使用するコードの例次に示します。このコード例は、IpcChannel クラストピック取り上げているコード例一部分です。

// Create the server channel.
IpcChannel serverChannel = 
    new IpcChannel("localhost:9090"); 
// Create the server channel.
IpcChannel^ serverChannel = gcnew IpcChannel( L"localhost:9090" );
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IpcChannel クラス
IpcChannel メンバ
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel プロパティ


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

参照参照

関連項目

IpcChannel クラス
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel メソッド


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

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CreateMessageSink 指定した URL またはチャネル データ オブジェクトメッセージ配信するチャネル メッセージ シンク返します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド GetUrlsForUri 指定した URI を持つオブジェクトすべての URL のうち、現在の IpcChannel でホストされている URL配列返します
パブリック メソッド Parse 指定した URL からチャネル URI既知リモート オブジェクト URI抽出します。
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド StartListening 現在のチャネルに対して要求待機開始するように指示します
パブリック メソッド StopListening 現在のチャネルに対して要求待機停止するように指示します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

IpcChannel クラス
System.Runtime.Remoting.Channels.Ipc 名前空間

IpcChannel メンバ

IPC プロトコル使用してメッセージ送信するチャネル実装提供します

IpcChannel データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CreateMessageSink 指定した URL またはチャネル データ オブジェクトメッセージ配信するチャネル メッセージ シンク返します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド GetUrlsForUri 指定した URI を持つオブジェクトすべての URL のうち、現在の IpcChannelホストされている URL配列返します
パブリック メソッド Parse 指定した URL からチャネル URI既知リモート オブジェクト URI抽出します。
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド StartListening 現在のチャネルに対して要求待機開始するように指示します
パブリック メソッド StopListening 現在のチャネルに対して要求待機停止するように指示します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

IpcChannel クラス
System.Runtime.Remoting.Channels.Ipc 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からIPC channelを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIPC channelを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIPC channelを検索

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

辞書ショートカット

すべての辞書の索引

「IPC channel」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS