TcpClientChannel 클래스

정의

TCP 프로토콜을 사용하여 메시지를 전송하는 원격 호출용 클라이언트 채널을 구현합니다.

public ref class TcpClientChannel : System::Runtime::Remoting::Channels::IChannelSender
public ref class TcpClientChannel : System::Runtime::Remoting::Channels::IChannelSender, System::Runtime::Remoting::Channels::ISecurableChannel
public class TcpClientChannel : System.Runtime.Remoting.Channels.IChannelSender
public class TcpClientChannel : System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel
type TcpClientChannel = class
    interface IChannelSender
    interface IChannel
type TcpClientChannel = class
    interface IChannelSender
    interface IChannel
    interface ISecurableChannel
Public Class TcpClientChannel
Implements IChannelSender
Public Class TcpClientChannel
Implements IChannelSender, ISecurableChannel
상속
TcpClientChannel
구현

예제

다음 코드 예제에서는 TcpClientChannel 원격 형식을 호출 하는 클래스입니다.

#using <System.Runtime.Remoting.dll>
#using <System.dll>
#using <Remotable.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
int main()
{
   
   // Set up a client channel.
   TcpClientChannel^ clientChannel = gcnew TcpClientChannel;
   ChannelServices::RegisterChannel( clientChannel );
   
   // Show the name and priority of the channel.
   Console::WriteLine( "Channel Name: {0}", clientChannel->ChannelName );
   Console::WriteLine( "Channel Priority: {0}", clientChannel->ChannelPriority );
   
   // Obtain a proxy for a remote object.
   RemotingConfiguration::RegisterWellKnownClientType( Remotable::typeid, "tcp://localhost:9090/Remotable.rem" );
   
   // Call a method on the object.
   Remotable ^ remoteObject = gcnew Remotable;
   Console::WriteLine( remoteObject->GetCount() );
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class Client
{
    public static void Main()
    {

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

        // Show the name and priority of the channel.
        Console.WriteLine("Channel Name: {0}", clientChannel.ChannelName);
        Console.WriteLine("Channel Priority: {0}", clientChannel.ChannelPriority);

        // Obtain a proxy for a remote object.
        RemotingConfiguration.RegisterWellKnownClientType(
            typeof(Remotable), "tcp://localhost:9090/Remotable.rem"
        );

        // Call a method on the object.
        Remotable remoteObject = new Remotable();
        Console.WriteLine( remoteObject.GetCount() );
    }
}

위의 예제에서 호출 된 원격 형식은 다음 코드에 의해 정의 됩니다.

using namespace System;
using namespace System::Runtime::Remoting;

public ref class Remotable: public MarshalByRefObject
{
private:
   int callCount;

public:
   Remotable()
      : callCount( 0 )
   {}

   int GetCount()
   {
      callCount++;
      return (callCount);
   }
};
using System;
using System.Runtime.Remoting;

public class Remotable : MarshalByRefObject
{

    private int callCount = 0;

    public int GetCount()
    {
        callCount++;
        return(callCount);
    }
}

설명

중요

신뢰할 수 없는 데이터로 이 클래스에서 메서드를 호출하는 것은 보안상 위험합니다. 신뢰할 수 있는 데이터로만 이 클래스에서 메서드를 호출하세요. 자세한 내용은 모든 입력 유효성 검사를 참조하세요.

채널 (예: 컴퓨터 또는 애플리케이션 도메인) remoting 경계 간에 메시지를 전송합니다. TcpClientChannel TCP 프로토콜을 사용 하 여 메시지를 전송 하는 클래스입니다.

채널은 원격 호출을 전송 하는.NET Framework remoting 인프라에서 사용 됩니다. 클라이언트가 원격 개체에 대 한 호출 하면 호출 클라이언트 채널에서 전송 및 서버 채널에서 수신 되는 메시지로 serialize 됩니다. 역직렬화하 처리 합니다. 반환 된 값 서버 채널에서 전송 되며 클라이언트 채널에서 수신 됩니다.

수행 하려면 추가 클라이언트 쪽에서 메시지 처리 지정할 수 있습니다 구현의 합니다 IClientChannelSinkProvider 인터페이스에 의해 처리 되는 모든 메시지는 TcpClientChannel 전달 됩니다.

기본적으로 TcpClientChannel 클래스는 모든 메시지를 serialize 하는 이진 포맷터를 사용 합니다.

TcpClientChannel 개체에 설정할 수 있는 구성 속성을 연결 된 런타임 구성 파일에서 (정적 호출 하 여 RemotingConfiguration.Configure 메서드) 또는 프로그래밍 방식으로 (전달 하 여를 IDictionary 컬렉션을 TcpClientChannel 생성자)입니다. 목록은 이러한 구성 속성에 대 한 설명서를 참조 하십시오. TcpClientChannel합니다.

생성자

TcpClientChannel()

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

TcpClientChannel(IDictionary, IClientChannelSinkProvider)

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

TcpClientChannel(String, IClientChannelSinkProvider)

지정된 이름 및 싱크를 사용하여 TcpClientChannel 클래스의 새 인스턴스를 초기화합니다.

속성

ChannelName

현재 채널의 이름을 가져옵니다.

ChannelPriority

현재 채널의 우선 순위를 가져옵니다.

IsSecured

현재 채널이 보안 채널인지 여부를 나타내는 부울 값을 가져오거나 설정합니다.

메서드

CreateMessageSink(String, Object, String)

지정된 URL이나 채널 데이터 개체에 메시지를 보내는 채널 메시지 싱크를 반환합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Parse(String, String)

지정된 URL에서 채널 URI와 잘 알려진 원격 개체 URI를 추출합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상