2011-09-18 57 views
2

我不知道该如何开始。谷歌搜索后,我发现这个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); 

但我不知道我需要什么。我尝试了一个here的示例,但收到了一条错误消息:“现有连接被远程主机强制关闭。”

我该如何继续?

回答

5

我会建议开沟UDP。而应使用Named Pipes

他们更可靠。

2

我认为这是更好地使用WCF与命名管道结合

0

命名管道是在同一系统上的最佳选择。 由于TCP性能更好,导致流量不使用网络接口。

相关问题