C# IPC信道跨进程通信

2021-05-23 15:28

阅读:737

标签:public   通讯   cli   ann   onclick   void   进程   span   ati   

Server端:注册信道

技术图片技术图片
1 /// 
2         /// 注册IPC管道通讯
3         /// 
4         public void IpcServer()
5         {
6             IpcServerChannel channel = new IpcServerChannel("ServerChannel");
7             ChannelServices.RegisterChannel(channel, false);
8             RemotingConfiguration.RegisterWellKnownServiceType(typeof(类型-class), "注册名称--对象名", WellKnownObjectMode.SingleCall);
9         }
View Code

Client端:连接获取信道

技术图片技术图片
1 IpcClientChannel channel = new IpcClientChannel();
2                 ChannelServices.RegisterChannel(channel, false);
3 
4                 (类型-class) obj = (类型-class)Activator.GetObject(typeof(类型-class), "ipc://ServerChannel/注册信道名-对象名");
5 
6                 
View Code

 

C# IPC信道跨进程通信

标签:public   通讯   cli   ann   onclick   void   进程   span   ati   

原文地址:https://www.cnblogs.com/BennyHua/p/11133414.html


评论


亲,登录后才可以留言!