对等网络应用程序的网络发现
我希望有两个类,一个服务器类和一个客户端类。服务器类应该接收每个新客户端的 IP 地址和端口号并将它们存储在列表中。它应该为每个客户端提供已连接客户端及其 IP 地址的列表。然后,客户端可以使用 TCP 连接相互通信。
问题是客户端不知道服务器的 IP 地址是什么。然而,整个程序将在局域网上运行。我的猜测是它需要某种 UDP 广播,但每次我尝试实现这一点时,除非程序的两个实例在同一台计算机上运行,否则它不起作用。
该应用程序将由计算知识有限的客户安装,因此只需在所有计算机上安装该程序并插入网络即可。
如果有人使用 C#.net 3.5 或更早版本对此有可靠、清晰的实现,我们将不胜感激。
I wish to have two classes, a server class and a client class. The server class should recieve the IP address and Port number of each new client and store them in a list. It should supply each of the clients with a list of connected clients and their IP addresses. The clients could then communicate with each other using TCP connections.
The catch is that the clients won't know what the IP address of the server is. The entire program will however run on a local area network. My guess is that it needs some sort of UDP broadcast, but every time I try to impliment this it doesn't work unless the two instances of the program are running on the same computer.
The application would be installed by clients with limited computing knowledge so it should just be a case of installing the program on all the computers and plugging in to the network.
If anyone has a reliable, clear implimentation of this using C#.net 3.5 or earlier it would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想也可能不想使用 Lidgren 网络库,但是源代码是可用的,它会进行 udp 广播以进行服务器发现,供您查看。
You may or may not want to use the Lidgren network library, but the source code is available and it does udp broadcast for server discovery for you to check out.
不确定这是否会对您有帮助 - 但您可以使用 WCF 和 .NET 3.5< /a>
Not sure if this will help you - but you could use WCF and .NET 3.5