IpcChannel 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 IpcChannel 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| IpcChannel() |
初始化該類別的新實例 IpcChannel ,僅啟用用戶端通道,而非伺服器通道。 |
| IpcChannel(String) |
初始化該類別的新實例 IpcChannel ,並以伺服器通道監聽指定的 IPC 埠。 |
| IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider) |
初始化一個具有指定配置屬性與匯入的類別新實例 IpcChannel 。 |
| IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider, CommonSecurityDescriptor) |
初始化一個具有指定配置屬性與匯入的類別新實例 IpcChannel 。 |
IpcChannel()
初始化該類別的新實例 IpcChannel ,僅啟用用戶端通道,而非伺服器通道。
public:
IpcChannel();
public IpcChannel();
Public Sub New ()
範例
以下程式碼範例說明如何使用此建構子。 此程式碼範例是本類別更大範例 IpcChannel 的一部分。
// Create the channel.
IpcChannel^ channel = gcnew IpcChannel;
// Create the channel.
IpcChannel channel = new IpcChannel();
適用於
IpcChannel(String)
初始化該類別的新實例 IpcChannel ,並以伺服器通道監聽指定的 IPC 埠。
public:
IpcChannel(System::String ^ portName);
public IpcChannel(string portName);
new System.Runtime.Remoting.Channels.Ipc.IpcChannel : string -> System.Runtime.Remoting.Channels.Ipc.IpcChannel
Public Sub New (portName As String)
參數
- portName
- String
IPC 埠的名稱。
範例
以下程式碼範例說明如何使用此建構子。 此程式碼範例是本類別更大範例 IpcChannel 的一部分。
// Create the server channel.
IpcChannel^ serverChannel = gcnew IpcChannel( L"localhost:9090" );
// Create the server channel.
IpcChannel serverChannel =
new IpcChannel("localhost:9090");
適用於
IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)
初始化一個具有指定配置屬性與匯入的類別新實例 IpcChannel 。
public:
IpcChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ clientSinkProvider, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ serverSinkProvider);
public IpcChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider);
new System.Runtime.Remoting.Channels.Ipc.IpcChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IClientChannelSinkProvider * System.Runtime.Remoting.Channels.IServerChannelSinkProvider -> System.Runtime.Remoting.Channels.Ipc.IpcChannel
Public Sub New (properties As IDictionary, clientSinkProvider As IClientChannelSinkProvider, serverSinkProvider As IServerChannelSinkProvider)
參數
- properties
- IDictionary
一個 IDictionary 集合,指定客戶端與伺服器通道所使用的配置屬性值。
- clientSinkProvider
- IClientChannelSinkProvider
客戶 IClientChannelSinkProvider 端通道將使用的實作。
- serverSinkProvider
- IServerChannelSinkProvider
伺服器 IServerChannelSinkProvider 通道將使用的實作。
範例
以下程式碼範例說明如何使用此建構子。 此程式碼範例是本類別更大範例 IpcChannel 的一部分。
// 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 );
// 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);
備註
欲了解更多通道配置屬性,請參閱 通道與形式配置屬性。
通道匯提供一個外掛點,允許存取通道中流經的底層訊息,以及傳輸機制用來向遠端物件傳送訊息的串流。 通道匯也負責在用戶端與伺服器間傳送訊息。 通道匯以鏈條相連,所有通道訊息在訊息最終序列化並傳輸前都會經過這條匯鏈。 如果你不需要匯入功能,請將 and clientSinkProvider 參數設serverSinkProvider為 null。
注意事項
在參數中設定exclusiveAddressUse屬性為 時falseproperties,可以為同一命名管線註冊多個IpcServerChannel物件。 在這種情況下,請求可以發送到任何註冊的頻道。 此設定僅在同時使用 ALC 時被視為安全。
另請參閱
適用於
IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider, CommonSecurityDescriptor)
初始化一個具有指定配置屬性與匯入的類別新實例 IpcChannel 。
public:
IpcChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ clientSinkProvider, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ serverSinkProvider, System::Security::AccessControl::CommonSecurityDescriptor ^ securityDescriptor);
public IpcChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider, System.Security.AccessControl.CommonSecurityDescriptor securityDescriptor);
new System.Runtime.Remoting.Channels.Ipc.IpcChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IClientChannelSinkProvider * System.Runtime.Remoting.Channels.IServerChannelSinkProvider * System.Security.AccessControl.CommonSecurityDescriptor -> System.Runtime.Remoting.Channels.Ipc.IpcChannel
Public Sub New (properties As IDictionary, clientSinkProvider As IClientChannelSinkProvider, serverSinkProvider As IServerChannelSinkProvider, securityDescriptor As CommonSecurityDescriptor)
參數
- properties
- IDictionary
一個 IDictionary 集合,指定客戶端與伺服器通道所使用的配置屬性值。
- clientSinkProvider
- IClientChannelSinkProvider
客戶 IClientChannelSinkProvider 端通道將使用的實作。
- serverSinkProvider
- IServerChannelSinkProvider
伺服器 IServerChannelSinkProvider 通道將使用的實作。
- securityDescriptor
- CommonSecurityDescriptor
安全描述符。