简体   繁体   中英

Communication between two programs on same computer – How?

I don't know how to begin. After Googling, I've found this here :

//This is how you do it (kudos to sipwiz)
UdpClient udpServer = new UdpClient(localpt); 

//This is what the proprietary (see question) sender would do (nothing special) 
//!!! The following 3 lines is what the poster needs...
//(and the definition of localpt, of course)
UdpClient udpServer2 = new UdpClient();
udpServer2.Client.SetSocketOption(
    SocketOptionLevel.Socket,
    SocketOptionName.ReuseAddress, true);

udpServer2.Client.Bind(localpt);

But I don't know what else I need. I tried an example from here , but got an error message: "An existing connection was forcibly closed by the remote host."

How do I proceed?

I'd suggest ditching UDP. Instead, use Named Pipes .

They are more reliable.

我认为最好将WCF与命名管道绑定一起使用

Named pipe is the best option on the same system. Due the fact that the performance is better then TCP cause the traffic is not using the network interfaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM