TcpServerChannel 构造函数
定义
初始化在指定端口上侦听的 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class that listens on the specified port.
重载
| TcpServerChannel(Int32) |
初始化在指定端口上侦听的 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class that listens on the specified port. |
| TcpServerChannel(IDictionary, IServerChannelSinkProvider) |
使用指定的信道属性和接收器初始化 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class with the specified channel properties and sink. |
| TcpServerChannel(String, Int32) |
使用给定名称初始化 TcpServerChannel 类的新实例,该实例侦听指定的端口。Initializes a new instance of the TcpServerChannel class with the given name and that listens on the specified port. |
| TcpServerChannel(IDictionary, IServerChannelSinkProvider, IAuthorizeRemotingConnection) |
使用指定的信道属性、接收器和授权提供程序初始化 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class with the specified channel properties, sink, and authorization provider. |
| TcpServerChannel(String, Int32, IServerChannelSinkProvider) |
以给定的名称初始化 TcpServerChannel 类的新实例,该实例侦听指定的端口并使用指定的接收器。Initializes a new instance of the TcpServerChannel class with the given name, which listens on the specified port, and uses the specified sink. |
TcpServerChannel(Int32)
初始化在指定端口上侦听的 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class that listens on the specified port.
public:
TcpServerChannel(int port);
public TcpServerChannel (int port);
new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel : int -> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
Public Sub New (port As Integer)
参数
- port
- Int32
信道侦听的端口。The port on which the channel listens.
示例
下面的代码示例演示如何使用此构造函数。The following code example shows the use of this constructor.
// Set up a server channel.
TcpServerChannel^ serverChannel = gcnew TcpServerChannel( 9090 );
ChannelServices::RegisterChannel( serverChannel );
// Set up a server channel.
TcpServerChannel serverChannel = new TcpServerChannel(9090);
ChannelServices.RegisterChannel(serverChannel);
注解
若要请求动态分配可用端口,请将参数设置 port 为 0 (零) 。To request that an available port be dynamically assigned, set the port parameter to 0 (zero).
适用于
TcpServerChannel(IDictionary, IServerChannelSinkProvider)
使用指定的信道属性和接收器初始化 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class with the specified channel properties and sink.
public:
TcpServerChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ sinkProvider);
public TcpServerChannel (System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IServerChannelSinkProvider -> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
Public Sub New (properties As IDictionary, sinkProvider As IServerChannelSinkProvider)
参数
- properties
- IDictionary
一个 IDictionary 集合,它为信道要使用的配置属性指定值。A IDictionary collection specifying values for configuration properties to be used by the channel.
- sinkProvider
- IServerChannelSinkProvider
信道要使用的 IServerChannelSinkProvider 实现。The IServerChannelSinkProvider implementation to be used by the channel.
例外
提供的信道属性有格式错误。A provided channel property was badly formatted.
示例
下面的代码示例演示如何使用此构造函数创建 TcpServerChannel 具有特定配置属性的对象。The following code example shows the use of this constructor to create a TcpServerChannel object with specific configuration properties.
// Specify server channel properties.
IDictionary^ dict = gcnew Hashtable;
dict[ "port" ] = 9090;
dict[ "authenticationMode" ] = "IdentifyCallers";
// Set up a server channel.
TcpServerChannel^ serverChannel = gcnew TcpServerChannel( dict, nullptr );
ChannelServices::RegisterChannel( serverChannel, false );
// Specify server channel properties.
IDictionary dict = new Hashtable();
dict["port"] = 9090;
dict["authenticationMode"] = "IdentifyCallers";
// Set up a server channel.
TcpServerChannel serverChannel = new TcpServerChannel(dict, null);
ChannelServices.RegisterChannel(serverChannel, false);
注解
有关通道配置属性的详细信息,请参阅 通道和格式化程序配置属性。For more information about channel configuration properties, see Channel and Formatter Configuration Properties.
备注
如果不需要接收器功能,请将参数设置 sinkProvider 为 null 。If you do not require sink functionality, set the sinkProvider parameter to null.
适用于
TcpServerChannel(String, Int32)
使用给定名称初始化 TcpServerChannel 类的新实例,该实例侦听指定的端口。Initializes a new instance of the TcpServerChannel class with the given name and that listens on the specified port.
public:
TcpServerChannel(System::String ^ name, int port);
public TcpServerChannel (string name, int port);
new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel : string * int -> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
Public Sub New (name As String, port As Integer)
参数
- name
- String
信道的名称。The name of the channel.
- port
- Int32
信道侦听的端口。The port on which the channel listens.
示例
下面的代码示例演示如何构造 TcpServerChannel 。The following code example shows how to construct a TcpServerChannel.
// Create the server channel.
TcpServerChannel^ channel = gcnew TcpServerChannel( "Server Channel",9090 );
// Create the server channel.
TcpServerChannel channel = new TcpServerChannel(
"Server Channel", 9090);
注解
此构造函数 ChannelName 使用参数设置属性 name 。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.
若要请求动态分配可用端口,请将参数设置 port 为 0 (零) 。To request that an available port be dynamically assigned, set the port parameter to 0 (zero).
适用于
TcpServerChannel(IDictionary, IServerChannelSinkProvider, IAuthorizeRemotingConnection)
使用指定的信道属性、接收器和授权提供程序初始化 TcpServerChannel 类的新实例。Initializes a new instance of the TcpServerChannel class with the specified channel properties, sink, and authorization provider.
public:
TcpServerChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ sinkProvider, System::Runtime::Remoting::Channels::IAuthorizeRemotingConnection ^ authorizeCallback);
public TcpServerChannel (System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider, System.Runtime.Remoting.Channels.IAuthorizeRemotingConnection authorizeCallback);
new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IServerChannelSinkProvider * System.Runtime.Remoting.Channels.IAuthorizeRemotingConnection -> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
Public Sub New (properties As IDictionary, sinkProvider As IServerChannelSinkProvider, authorizeCallback As IAuthorizeRemotingConnection)
参数
- properties
- IDictionary
一个 IDictionary 集合,它为信道要使用的配置属性指定值。A IDictionary collection that specifies values for configuration properties to be used by the channel.
- sinkProvider
- IServerChannelSinkProvider
信道要使用的 IServerChannelSinkProvider 实现。The IServerChannelSinkProvider implementation to be used by the channel.
- authorizeCallback
- IAuthorizeRemotingConnection
信道要使用的 IAuthorizeRemotingConnection 实现。The IAuthorizeRemotingConnection implementation to be used by the channel.
例外
提供的信道属性有格式错误。A provided channel property was badly formatted.
注解
有关通道配置属性的详细信息,请参阅 通道和格式化程序配置属性。For more information about channel configuration properties, see Channel and Formatter Configuration Properties.
适用于
TcpServerChannel(String, Int32, IServerChannelSinkProvider)
以给定的名称初始化 TcpServerChannel 类的新实例,该实例侦听指定的端口并使用指定的接收器。Initializes a new instance of the TcpServerChannel class with the given name, which listens on the specified port, and uses the specified sink.
public:
TcpServerChannel(System::String ^ name, int port, System::Runtime::Remoting::Channels::IServerChannelSinkProvider ^ sinkProvider);
public TcpServerChannel (string name, int port, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel : string * int * System.Runtime.Remoting.Channels.IServerChannelSinkProvider -> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
Public Sub New (name As String, port As Integer, sinkProvider As IServerChannelSinkProvider)
参数
- name
- String
信道的名称。The name of the channel.
- port
- Int32
信道侦听的端口。The port on which the channel listens.
- sinkProvider
- IServerChannelSinkProvider
信道要使用的 IServerChannelSinkProvider 实现。The IServerChannelSinkProvider implementation to be used by the channel.
示例
下面的代码示例演示如何构造 TcpServerChannel 。The following code example shows how to construct a TcpServerChannel.
// Create the server channel.
TcpServerChannel^ channel = gcnew TcpServerChannel(
L"Server Channel",9090,nullptr );
// Create the server channel.
TcpServerChannel channel = new TcpServerChannel(
"Server Channel", 9090, null);
注解
此构造函数 ChannelName 使用参数设置属性 name 。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.
若要请求动态分配可用端口,请将参数设置 port 为 0 (零) 。To request that an available port be dynamically assigned, set the port parameter to 0 (zero).
如果不需要接收器功能,请将参数设置 sinkProvider 为 null 。If you do not require sink functionality, set the sinkProvider parameter to null.