[英]how to make communication with two different process in same computer?
there is two separate processed running on same PC i want to communicate between this two process. 我想在这两个进程之间进行通信,在同一台PC上运行着两个单独的进程。 like pass some data from one process to other . 例如将一些数据从一个进程传递到另一个过程。
WCF
Windows Communication Foundation Windows Communication Foundation
In general you need to implement a client - server architecture and define interface endpoints to communicate between the process that acts as client and the server process. 通常,您需要实现客户端-服务器体系结构并定义接口终结点,以在充当客户端的进程和服务器进程之间进行通信。
The other way is to create a Remotable Class a dynamic library (DLL) so that the same remoted class can be referenced by both the client and the server. 另一种方法是创建动态库(DLL)的可远程类,以便客户端和服务器都可以引用相同的远程类。
The server will have to create instance of the remote class to be able to make sense of the object-oriented data you communicate, and can listen for example on a TCP channel. 服务器将必须创建远程类的实例,以便能够理解您通信的面向对象的数据,并可以在TCP通道上进行侦听。
eg 例如
ChannelServices.RegisterChannel( new TcpChannel( PORT_NUMBER) );
RemotingServices.Marshal( your_remoted_class, "name_connection" );
Or for local use you can just use the IpcServerChannel API 或者供本地使用,您可以只使用IpcServerChannel API
Now on Client if you used TCP port to listen on for server 现在在客户端上(如果您使用TCP端口侦听服务器)
string remoted_url = "tcp://localhost:<your_port_number>/connection name";
remoted_object = (RemotedClass)RemotingServices.Connect
( typeof(RemotedClass), remoted_url );
The client can now call the public functions through remote_object. 客户端现在可以通过remote_object调用公共功能。
If you are little bit specific about technology, then I could narrow down my answer. 如果您对技术不太了解,那么我可以缩小答案范围。
In a very generic note, these are ways to communicate between two processes. 概括地说,这是在两个流程之间进行通信的方式。
There are several other ways. 还有其他几种方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.