IpcChannel 建構函式

定義

初始化 IpcChannel 類別的新執行個體。

多載

IpcChannel()

初始化 IpcChannel 類別的新執行個體,只啟動用戶端通道,不啟動伺服器通道。

IpcChannel(String)

使用接聽指定 IPC 連接埠的伺服器通道,初始化 IpcChannel 類別的新執行個體。

IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

使用指定的組態屬性和接收,初始化 IpcChannel 類別的新執行個體。

IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider, CommonSecurityDescriptor)

使用指定的組態屬性和接收,初始化 IpcChannel 類別的新執行個體。

IpcChannel()

初始化 IpcChannel 類別的新執行個體,只啟動用戶端通道,不啟動伺服器通道。

C#
public IpcChannel ();

範例

下列程式代碼範例示範如何使用這個建構函式。 此程式代碼範例是提供給 類別之較大範例的 IpcChannel 一部分。

C#
// Create the channel.
IpcChannel channel = new IpcChannel();

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

IpcChannel(String)

使用接聽指定 IPC 連接埠的伺服器通道,初始化 IpcChannel 類別的新執行個體。

C#
public IpcChannel (string portName);

參數

portName
String

IPC 連接埠的名稱。

範例

下列程式代碼範例示範如何使用這個建構函式。 此程式代碼範例是提供給 類別之較大範例的 IpcChannel 一部分。

C#
// Create the server channel.
IpcChannel serverChannel =
    new IpcChannel("localhost:9090");

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

使用指定的組態屬性和接收,初始化 IpcChannel 類別的新執行個體。

C#
public IpcChannel (System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider);

參數

properties
IDictionary

IDictionary 集合,指定用戶端和伺服器通道將使用的組態屬性值。

clientSinkProvider
IClientChannelSinkProvider

用戶端通道要使用的 IClientChannelSinkProvider 實作。

serverSinkProvider
IServerChannelSinkProvider

伺服器通道要使用的 IServerChannelSinkProvider 實作。

範例

下列程式代碼範例示範如何使用這個建構函式。 此程式代碼範例是提供給 類別之較大範例的 IpcChannel 一部分。

C#
// 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);

備註

如需通道組態屬性的詳細資訊,請參閱 通道和格式器組態屬性

通道接收提供外掛程式點,允許存取流經通道的基礎訊息,以及傳輸機制用來將訊息傳送至遠端物件的數據流。 通道接收也負責傳輸客戶端與伺服器之間的訊息。 通道接收會在鏈結中連結在一起,而且所有通道訊息都會流經這個接收鏈結,然後再最後串行化和傳輸訊息。 如果您不需要接收功能,請將 clientSinkProviderserverSinkProvider 參數設定為 null

注意

在 自變數中將 exclusiveAddressUse 屬性設定為 false 時,可以針對相同的命名管道註冊數IpcServerChannelproperties物件。 在這種情況下,要求可以移至任何已註冊的通道。 只有在也使用 ALC 時,才會將此設定視為安全。

另請參閱

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

IpcChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider, CommonSecurityDescriptor)

使用指定的組態屬性和接收,初始化 IpcChannel 類別的新執行個體。

C#
public IpcChannel (System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider, System.Security.AccessControl.CommonSecurityDescriptor securityDescriptor);

參數

properties
IDictionary

IDictionary 集合,指定用戶端和伺服器通道將使用的組態屬性值。

clientSinkProvider
IClientChannelSinkProvider

用戶端通道要使用的 IClientChannelSinkProvider 實作。

serverSinkProvider
IServerChannelSinkProvider

伺服器通道要使用的 IServerChannelSinkProvider 實作。

securityDescriptor
CommonSecurityDescriptor

安全性描述元。

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1