created by Aha00aAha00a at 2009-08-27
last modified by Aha00aAha00a at 2009-08-27
revision: 6

.Net Remoting

1. Overview

  • 원격에서 사용하려면 MarshalByRefObject를 상속해야 한다.
  • 서버에서는 채널을 만들고, .Net Remoting 시스템에 등록한다.
    • DotNetFramework에서 기본적으로 제공하는 채널 - HttpChannel, TcpChannel, IpcChannel
ProjA // 공유할 클래스(혹은 인스턴스)를 갖고있다.
	class CToShare : MarshalByRefObject

ProjB // Server 프로젝트 - Listen
	ChannelServices.RegisterChannel(new TcpChannel(2314));
	RemotingConfiguration.RegisterWellKnownServiceType( 
		typeof(CToShare), 
		"CToShare", 
		WellKnownObjectMode.SingleCall);
	Sleep(------)

ProjC // Client 프로젝트 - Connect
	ChannelServices.RegisterChannel(new TcpChannel()); // port없음
	CToShare toShare = (CToShare)Activator.GetObject(
		typeof(CToShare),
		"tcp://localhost:2314/CToShare"
	);
	
	CAssertUtil.IsNotNull(toShare);

3. See Also

3.2. Adjacent Pages

≤ 32
all
1.0x
1.0x
80
-120
ON
0/0
0/0
0.00
0
0 / 0
1.00x