.NET 的简单对等网络库
我有一个服务器应用程序,需要查找本地 LAN 上的其他实例并与其交换少量数据。
这不是应用程序的关键部分。
它必须在没有中央服务器或高级配置的情况下点对点完成。
是否有现有的库可以执行类似的操作?
编辑
我应该提到我正在使用 .NET 2.0 并且更喜欢基于 Windows 套接字的东西。
I have a server application that needs to find and exchange small amounts of data with other instances of itself on a local LAN.
This is not a critical piece of the application.
It must be done peer to peer without a central server or advance configuration.
Are there any existing libraries that do something like this?
EDIT
I should mention I am using .NET 2.0 and prefer something based on Windows sockets.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只关心本地 LAN,则简单的广播协议应该可以使用。 让每个客户端侦听特定端口(可能在单独的线程中)。 当一个客户端想要通信时,让它在该端口上广播到本地网络。 然后,每个侦听客户端都应使用其连接信息进行响应 - 它用于接受数据的地址/端口。 然后,发送客户端可以选择将数据发送到哪个客户端并正常连接到该客户端。
或者,如果数据不敏感并且传送不需要可靠,您可以简单地广播该信息以及有关哪个客户端是预期接收者的信息,并让感兴趣的客户端接收它。
If you're only concerned with a local LAN, a simple broadcast protocol should work. Have each client listen on a particular port (probably in a separate thread). When one client wants to communicate, have it broadcast on that port to the local network. Each listening client should then respond with it's connection information -- what address/port it uses for accepting data. The sending client can then choose which client(s) to send the data to and connect to that(those) client(s) normally.
Alternatively, if the data is not sensitive and delivery doesn't need to be reliable, you could simply broadcast the information, along with the information on which client is the intended recipient, and let the client(s) that are interested pick it up.
C4F Vista 对等工具包
http://www.codeplex.com/C4FP2P
C4F Vista Peer-to-Peer Toolkit
http://www.codeplex.com/C4FP2P