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);