語言

TcpClientChannel 建構函式

定義

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

多載

名稱 Description
TcpClientChannel()

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

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

初始化一個新的類別實例 TcpClientChannel ,並具備指定的組態屬性與 sink。

TcpClientChannel(String, IClientChannelSinkProvider)

初始化一個以指定名稱和 sink 的新 TcpClientChannel 類別實例。

TcpClientChannel()

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

public:
 TcpClientChannel();
public TcpClientChannel();
Public Sub New ()

範例

以下程式碼範例展示了此建構子的使用方法。

// Set up a client channel.
TcpClientChannel^ clientChannel = gcnew TcpClientChannel;
ChannelServices::RegisterChannel( clientChannel );
// Set up a client channel.
TcpClientChannel clientChannel = new TcpClientChannel();
ChannelServices.RegisterChannel(clientChannel);

備註

這個建構子回傳的實例的設定屬性 TcpClientChannel 都設定為預設值。

適用於

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

初始化一個新的類別實例 TcpClientChannel ,並具備指定的組態屬性與 sink。

public:
 TcpClientChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public TcpClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Tcp.TcpClientChannel
Public Sub New (properties As IDictionary, sinkProvider As IClientChannelSinkProvider)

參數

properties
IDictionary

一個 IDictionary 集合,指定通道將使用的配置屬性值。

sinkProvider
IClientChannelSinkProvider

IServerChannelSinkProvider頻道將使用的實作。

例外狀況

一個設定屬性格式錯誤。

範例

以下程式碼範例展示了使用此建構子建立 TcpClientChannel 具有特定組態屬性的物件。

// Specify client channel properties.
IDictionary^ dict = gcnew Hashtable;
dict[ "port" ] = 9090;
dict[ "impersonationLevel" ] = "Identify";
dict[ "authenticationPolicy" ] = "AuthPolicy, Policy";

// Set up a client channel.
TcpClientChannel^ clientChannel = gcnew TcpClientChannel( dict, nullptr );
ChannelServices::RegisterChannel( clientChannel, false );
// Specify client channel properties.
IDictionary dict = new Hashtable();
dict["port"] = 9090;
dict["impersonationLevel"] = "Identify";
dict["authenticationPolicy"] = "AuthPolicy, Policy";

// Set up a client channel.
TcpClientChannel clientChannel = new TcpClientChannel(dict, null);
ChannelServices.RegisterChannel(clientChannel, false);

備註

欲了解更多通道配置屬性,請參閱 通道與形式配置屬性。

如果你不需要匯入功能,請將參數設 sinkProvider 為 null。

另請參閱

適用於

TcpClientChannel(String, IClientChannelSinkProvider)

初始化一個以指定名稱和 sink 的新 TcpClientChannel 類別實例。

public:
 TcpClientChannel(System::String ^ name, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public TcpClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel : string * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Tcp.TcpClientChannel
Public Sub New (name As String, sinkProvider As IClientChannelSinkProvider)

參數

name
String

頻道的名稱。

sinkProvider
IClientChannelSinkProvider

IClientChannelSinkProvider頻道將使用的實作。

範例

以下程式碼範例說明如何構造一個 TcpClientChannel。

// Create the channel.
TcpClientChannel^ clientChannel = gcnew TcpClientChannel( "Client",nullptr );
// Create the channel.
TcpClientChannel clientChannel = new TcpClientChannel("Client", null);

備註

此建構子透過參數ChannelName設定性質name。 如果你想註冊多個頻道,每個頻道必須有獨特的名稱。

如果你不需要匯入功能,請將參數設 sinkProvider 為 null。

適用於