Initializes a new instance of the
TcpChannel class with a server channel that listens on the specified port.
Namespace: System.Runtime.Remoting.Channels.Tcp
Assembly: System.Runtime.Remoting (in system.runtime.remoting.dll)
Visual Basic (Declaration)
Public Sub New ( _
port As Integer _
)
Dim port As Integer
Dim instance As New TcpChannel(port)
public TcpChannel (
int port
)
public:
TcpChannel (
int port
)
public TcpChannel (
int port
)
public function TcpChannel (
port : int
)
Parameters
- port
The port on which the server channel listens.
To request that the remoting system choose an open port on your behalf, specify port 0 (zero). This will create a TcpServerChannel instance to listen for requests on the dynamically assigned port. This is typically done on the client to make sure that a TcpServerChannel is listening for callback methods.
The following code example demonstrates using this method. To request that an available port be dynamically assigned, set the port parameter to zero.
' Registers the server and waits until the user hits enter.
Dim chan As New TcpChannel(8084)
ChannelServices.RegisterChannel(chan)
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("HelloServer,server"), "SayHello", WellKnownObjectMode.SingleCall)
System.Console.WriteLine("Hit <enter> to exit...")
System.Console.ReadLine()
// Registers the server and waits until the user hits enter.
TcpChannel chan = new TcpChannel(8084);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("HelloServer,server"),
"SayHello",
WellKnownObjectMode.SingleCall);
System.Console.WriteLine("Hit <enter> to exit...");
System.Console.ReadLine();
// Registers the server and waits until the user hits enter.
TcpChannel^ chan = gcnew TcpChannel( 8084 );
ChannelServices::RegisterChannel( chan );
RemotingConfiguration::RegisterWellKnownServiceType(
Type::GetType( "HelloServer,server" ),
"SayHello",
WellKnownObjectMode::SingleCall );
System::Console::WriteLine( L"Hit <enter> to exit..." );
System::Console::ReadLine();
// Registers the server and waits until the user hits enter.
TcpChannel chan = new TcpChannel(8084);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(Type.
GetType("HelloServer,server"), "SayHello",
WellKnownObjectMode.SingleCall);
System.Console.WriteLine("Hit <enter> to exit...");
System.Console.ReadLine();
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
.NET Framework
Supported in: 2.0, 1.1, 1.0