RemotingServices.Connect 메서드

정의

잘 알려진 개체에 대한 프록시를 만듭니다.

오버로드

Name Description
Connect(Type, String)

및 URL이 지정된 경우 잘 알려진 개체에 대한 프록시를 Type 만듭니다.

Connect(Type, String, Object)

, URL 및 채널별 데이터가 지정된 경우 잘 알려진 개체에 Type대한 프록시를 만듭니다.

Connect(Type, String)

및 URL이 지정된 경우 잘 알려진 개체에 대한 프록시를 Type 만듭니다.

public:
 static System::Object ^ Connect(Type ^ classToProxy, System::String ^ url);
public static object Connect(Type classToProxy, string url);
[System.Runtime.InteropServices.ComVisible(true)]
public static object Connect(Type classToProxy, string url);
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public static object Connect(Type classToProxy, string url);
static member Connect : Type * string -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Connect : Type * string -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
static member Connect : Type * string -> obj
Public Shared Function Connect (classToProxy As Type, url As String) As Object

매개 변수

classToProxy
Type

Type 연결할 서버 끝의 잘 알려진 개체입니다.

url
String

서버 클래스의 URL입니다.

반품

지정된 잘 알려진 개체가 제공하는 엔드포인트를 가리키는 원격 개체에 대한 프록시입니다.

특성

예외

즉시 호출자에게 원격 유형 및 채널을 구성할 수 있는 권한이 없습니다.

예제

다음 코드 예제에서는 메서드를 사용하여 Connect 잘 알려진 개체에 대한 프록시를 만드는 방법을 보여 줍니다.

Console::WriteLine( "Connecting to SampleNamespace::SampleWellKnown." );
SampleWellKnown ^ proxy = dynamic_cast<SampleWellKnown^>(RemotingServices::Connect( SampleWellKnown::typeid, const_cast<String^>(SERVER_URL) ));
Console::WriteLine( "Connected to SampleWellKnown" );

// Verifies that the Object* reference is to a transparent proxy.
if ( RemotingServices::IsTransparentProxy( proxy ) )
      Console::WriteLine( "proxy is a reference to a transparent proxy." );
else
      Console::WriteLine( "proxy is not a transparent proxy.  This is unexpected." );

// Calls a method on the server Object*.
Console::WriteLine( "proxy->Add returned {0}.", proxy->Add( 2, 3 ) );
Console.WriteLine("Connecting to SampleNamespace.SampleWellKnown.");

SampleWellKnown proxy =
   (SampleWellKnown)RemotingServices.Connect(typeof(SampleWellKnown), SERVER_URL);

Console.WriteLine("Connected to SampleWellKnown");

// Verifies that the object reference is to a transparent proxy.
if (RemotingServices.IsTransparentProxy(proxy))
    Console.WriteLine("proxy is a reference to a transparent proxy.");
else
    Console.WriteLine("proxy is not a transparent proxy.  This is unexpected.");

// Calls a method on the server object.
Console.WriteLine("proxy.Add returned {0}.", proxy.Add(2, 3));
Console.WriteLine("Connecting to SampleNamespace.SampleWellKnown.")

Dim proxy As SampleWellKnown = _
   CType(RemotingServices.Connect(GetType(SampleWellKnown), SERVER_URL), SampleWellKnown)

Console.WriteLine("Connected to SampleWellKnown")

' Verifies that the object reference is to a transparent proxy.
If RemotingServices.IsTransparentProxy(proxy) Then
   Console.WriteLine("proxy is a reference to a transparent proxy.")
Else
   Console.WriteLine("proxy is not a transparent proxy.  This is unexpected.")
End If

' Calls a method on the server object.
Console.WriteLine("proxy.Add returned {0}.", proxy.Add(2, 3))

설명

반환된 프록시 개체는 지정된 잘 알려진 개체가 제공하는 엔드포인트를 가리킵니다. 프록시에서 메서드가 호출될 때까지 네트워크를 통해 메시지가 전송되지 않습니다.

적용 대상

Connect(Type, String, Object)

, URL 및 채널별 데이터가 지정된 경우 잘 알려진 개체에 Type대한 프록시를 만듭니다.

public:
 static System::Object ^ Connect(Type ^ classToProxy, System::String ^ url, System::Object ^ data);
public static object Connect(Type classToProxy, string url, object data);
[System.Runtime.InteropServices.ComVisible(true)]
public static object Connect(Type classToProxy, string url, object data);
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public static object Connect(Type classToProxy, string url, object data);
static member Connect : Type * string * obj -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
static member Connect : Type * string * obj -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
static member Connect : Type * string * obj -> obj
Public Shared Function Connect (classToProxy As Type, url As String, data As Object) As Object

매개 변수

classToProxy
Type

Type 연결하려는 잘 알려진 개체의 개체입니다.

url
String

잘 알려진 개체의 URL입니다.

data
Object

채널별 데이터입니다. null일 수 있습니다.

반품

요청된 잘 알려진 개체에서 제공하는 엔드포인트를 가리키는 프록시입니다.

특성

예외

즉시 호출자에게 원격 유형 및 채널을 구성할 수 있는 권한이 없습니다.

설명

반환된 프록시 개체는 지정된 잘 알려진 개체가 제공하는 엔드포인트를 가리킵니다. 프록시에서 메서드가 호출될 때까지 네트워크를 통해 메시지가 전송되지 않습니다.

개체는 data 채널에 정보를 전달하는 데 사용되며 메서드에 IChannelSender.CreateMessageSink 전달됩니다.

적용 대상