簡體   English   中英

同一台計算機上的兩個程序之間的通信-如何進行?

[英]Communication between two programs on same computer – How?

我不知道該如何開始。 谷歌搜索后,我在這里找到

//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);

但是我不知道我還需要什么。 我從此處嘗試了一個示例,但收到一條錯誤消息: “現有連接被遠程主機強行關閉。”

我該怎么辦?

我建議放棄UDP。 而是使用命名管道

它們更可靠。

我認為最好將WCF與命名管道綁定一起使用

命名管道是同一系統上的最佳選擇。 由於性能好於TCP,因此導致流量未使用網絡接口。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM