TcpChannel 생성자

정의

TcpChannel 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
TcpChannel()

서버 채널이 아닌 클라이언트 채널만 활성화하여 클래스의 TcpChannel 새 인스턴스를 초기화합니다.

TcpChannel(Int32)

지정된 포트에서 수신 대기하는 서버 채널을 사용하여 클래스의 TcpChannel 새 인스턴스를 초기화합니다.

TcpChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

지정된 구성 속성 및 싱크를 TcpChannel 사용하여 클래스의 새 인스턴스를 초기화합니다.

TcpChannel()

서버 채널이 아닌 클라이언트 채널만 활성화하여 클래스의 TcpChannel 새 인스턴스를 초기화합니다.

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

예제

다음 코드 예제에서는이 생성자를 사용 하는 방법을 보여 있습니다.

// Create the channel.
TcpChannel^ clientChannel = gcnew TcpChannel();
// Create the channel.
TcpChannel clientChannel = new TcpChannel();

설명

매개 변수가 없는 생성자는 모든 필드를 기본값으로 초기화합니다. 매개 변수가 없는 생성자를 사용하는 경우 채널은 클라이언트 채널로만 작동하며 포트에서 수신 대기하지 않습니다.

적용 대상

TcpChannel(Int32)

지정된 포트에서 수신 대기하는 서버 채널을 사용하여 클래스의 TcpChannel 새 인스턴스를 초기화합니다.

public:
 TcpChannel(int port);
public TcpChannel(int port);
new System.Runtime.Remoting.Channels.Tcp.TcpChannel : int -> System.Runtime.Remoting.Channels.Tcp.TcpChannel
Public Sub New (port As Integer)

매개 변수

port
Int32

서버 채널이 수신 대기하는 포트입니다.

예제

다음 코드 예제에서는 이 메서드를 사용하는 방법을 보여 줍니다. 사용 가능한 포트를 동적으로 할당하도록 요청하려면 매개 변수를 port 0으로 설정합니다.

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

설명

원격 시스템이 사용자 대신 열린 포트를 선택하도록 요청하려면 포트 0(0)을 지정합니다. 그러면 동적으로 할당된 포트에서 요청을 수신 대기하는 인스턴스가 생성 TcpServerChannel 됩니다. 이 작업은 일반적으로 클라이언트에서 콜백 메서드를 TcpServerChannel 수신 대기하는지 확인하기 위해 수행됩니다.

0이 생성자에 TcpChannel 전달되면 자유 포트를 사용하도록 인스턴스화됩니다.

적용 대상

TcpChannel(IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

지정된 구성 속성 및 싱크를 TcpChannel 사용하여 클래스의 새 인스턴스를 초기화합니다.

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

매개 변수

properties
IDictionary

IDictionary 클라이언트 및 서버 채널에서 사용할 구성 속성의 값을 지정하는 컬렉션입니다.

clientSinkProvider
IClientChannelSinkProvider

IClientChannelSinkProvider 클라이언트 채널에서 사용할 구현입니다.

serverSinkProvider
IServerChannelSinkProvider

IServerChannelSinkProvider 서버 채널에서 사용할 구현입니다.

예외

제공된 채널 속성의 형식이 잘못 지정되었습니다.

예제

다음 코드 예제에서는이 생성자를 사용 하는 방법을 보여 있습니다.

// Specify the properties for the server channel.
System::Collections::IDictionary^ dict = gcnew System::Collections::Hashtable;
dict[ "port" ] = 9090;
dict[ "authenticationMode" ] = "IdentifyCallers";

// Set up the server channel.
TcpChannel^ serverChannel = gcnew TcpChannel( dict,nullptr,nullptr );
ChannelServices::RegisterChannel( serverChannel );
// Specify the properties for the server channel.
System.Collections.IDictionary dict =
    new System.Collections.Hashtable();
dict["port"] = 9090;
dict["authenticationMode"] = "IdentifyCallers";

// Set up the server channel.
TcpChannel serverChannel = new TcpChannel(dict, null, null);
ChannelServices.RegisterChannel(serverChannel);

설명

채널 구성 속성에 대한 자세한 내용은 채널 및 포맷터 구성 속성을 참조하세요.

채널 싱크는 채널을 통해 흐르는 기본 메시지와 전송 메커니즘에서 원격 개체로 메시지를 보내는 데 사용하는 스트림에 액세스할 수 있는 플러그 인 지점을 제공합니다. 또한 채널 싱크는 클라이언트와 서버 간에 메시지를 전송하는 역할을 합니다. 채널 싱크는 체인에서 함께 연결되며, 모든 채널 메시지는 메시지가 마지막으로 직렬화되고 전송되기 전에 이 싱크 체인을 통해 흐릅니다. 싱크 기능이 필요하지 않은 경우 및 clientSinkProvider 매개 변수serverSinkProvidernull .로 설정합니다.

추가 정보

적용 대상