Server端:注册信道
1 /// <summary> 2 /// 注册IPC管道通讯 3 /// </summary> 4 public void IpcServer() 5 { 6 IpcServerChannel channel = new IpcServerChannel("ServerChannel"); 7 ChannelServices.RegisterChannel(channel, false); 8 RemotingConfiguration.RegisterWellKnownServiceType(typeof(类型-class), "注册名称--对象名", WellKnownObjectMode.SingleCall); 9 }
Client端:连接获取信道
1 IpcClientChannel channel = new IpcClientChannel(); 2 ChannelServices.RegisterChannel(channel, false); 3 4 (类型-class) obj = (类型-class)Activator.GetObject(typeof(类型-class), "ipc://ServerChannel/注册信道名-对象名"); 5 6