Edit

Share via


TcpClientChannel Constructors

Definition

Initializes a new instance of the TcpClientChannel class.

Overloads

TcpClientChannel()

Initializes a new instance of the TcpClientChannel class.

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

Initializes a new instance of the TcpClientChannel class with the specified configuration properties and sink.

TcpClientChannel(String, IClientChannelSinkProvider)

Initializes a new instance of the TcpClientChannel class with the specified name and sink.

TcpClientChannel()

Initializes a new instance of the TcpClientChannel class.

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

Examples

The following code example shows the use of this constructor.

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

Remarks

The configuration properties of the TcpClientChannel instance returned by this constructor are all set to their default values.

Applies to

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

Initializes a new instance of the TcpClientChannel class with the specified configuration properties and 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)

Parameters

properties
IDictionary

A IDictionary collection that specifies values for configuration properties to be used by the channel.

sinkProvider
IClientChannelSinkProvider

The IServerChannelSinkProvider implementation to be used by the channel.

Exceptions

A configuration property was incorrectly formatted.

Examples

The following code example shows the use of this constructor to create a TcpClientChannel object with specific configuration properties.

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

Remarks

For more information about channel configuration properties, see Channel and Formatter Configuration Properties.

If you do not require sink functionality, set the sinkProvider parameter to null.

See also

Applies to

TcpClientChannel(String, IClientChannelSinkProvider)

Initializes a new instance of the TcpClientChannel class with the specified name and sink.

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)

Parameters

name
String

The name of the channel.

sinkProvider
IClientChannelSinkProvider

The IClientChannelSinkProvider implementation to be used by the channel.

Examples

The following code example shows how to construct a TcpClientChannel.

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

Remarks

This constructor sets the ChannelName property by using the name parameter. If you want to register more than one channel, each channel must have a unique name.

If you do not require sink functionality, set the sinkProvider parameter to null.

Applies to