我不知道该如何开始.谷歌搜索后,我在这里找到了这个:
//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);
Run Code Online (Sandbox Code Playgroud)
但我不知道我还需要什么.我从这里尝试了一个示例,但收到一条错误消息:"现有连接被远程主机强行关闭."
我该怎么办?
| 归档时间: |
|
| 查看次数: |
1657 次 |
| 最近记录: |