Compartilhar via


TcpClientChannel Construtores

Definição

Inicializa uma nova instância da classe TcpClientChannel.

Sobrecargas

TcpClientChannel()

Inicializa uma nova instância da classe TcpClientChannel.

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

Inicializa uma nova instância da classe TcpClientChannel com as propriedades de configuração e o coletor especificados.

TcpClientChannel(String, IClientChannelSinkProvider)

Inicializa uma nova instância da classe TcpClientChannel com o nome e o coletor especificados.

TcpClientChannel()

Inicializa uma nova instância da classe TcpClientChannel.

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

Exemplos

O exemplo de código a seguir mostra o uso desse construtor.

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

Comentários

As propriedades de configuração da TcpClientChannel instância retornada por esse construtor são definidas com seus valores padrão.

Aplica-se a

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

Inicializa uma nova instância da classe TcpClientChannel com as propriedades de configuração e o coletor especificados.

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)

Parâmetros

properties
IDictionary

Uma coleção IDictionary que especifica valores para propriedades de configuração a serem usada pelo canal.

sinkProvider
IClientChannelSinkProvider

A implementação IServerChannelSinkProvider a ser usada pelo canal.

Exceções

Uma propriedade de configuração foi formatada incorretamente.

Exemplos

O exemplo de código a seguir mostra o uso desse construtor para criar um TcpClientChannel objeto com propriedades de configuração específicas.

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

Comentários

Para obter mais informações sobre as propriedades de configuração de canal, consulte Propriedades de configuração de canal e formatador.

Se você não precisar da funcionalidade do coletor, defina o sinkProvider parâmetro como null.

Confira também

Aplica-se a

TcpClientChannel(String, IClientChannelSinkProvider)

Inicializa uma nova instância da classe TcpClientChannel com o nome e o coletor especificados.

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)

Parâmetros

name
String

O nome do canal.

sinkProvider
IClientChannelSinkProvider

A implementação IClientChannelSinkProvider a ser usada pelo canal.

Exemplos

O exemplo de código a seguir mostra como construir um TcpClientChannel.

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

Comentários

Esse construtor define a ChannelName propriedade usando o name parâmetro . Se você quiser registrar mais de um canal, cada canal deverá ter um nome exclusivo.

Se você não precisar da funcionalidade do coletor, defina o sinkProvider parâmetro como null.

Aplica-se a