远程处理服务器自动发现。 播出还是不播出?
我有一个与 .Net 远程通信的客户端/服务器应用程序。 我需要我的客户端能够在网络上找到服务器,而不需要客户端配置。
据我所知,远程处理不支持发现。 我准备实施一个 UDP 解决方案,客户端将能够通过广播消息找到服务器。
在我继续之前,我想听听集体智慧。 这是最好的方法吗? 还有其他建议吗?
I have a client/server application that communicates with .Net remoting. I need my clients to be able to find the server(s) on the network without requiring client-side configuration.
As far as I know, there is no support for discovery in remoting. I am prepared to implement a UDP solution where the clients will be able to find the servers via broadcast messages.
I want to hear the collective SO wisdom before I go ahead. Is this the best way? Any other suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我已经研究过 SSDP 和 UPnP 的此类功能,但我建议使用自定义 UDP 多播解决方案。 基本上,多播与广播非常相似,但只有已加入多播组(即请求广播)的计算机才会被联系。
恕我直言,SSDP 和 UPnP 以及臃肿且过于复杂的资源发现......但是,嘿,这是一个标准。 ;)
I've looked at both SSDP and UPnP for this type of functionality, but I'd recommend going with a custom UDP multicast solution. Basically, multicast is very similar to a broadcast, but only machines that have joined the multicast group (i.e. requested the broadcast) are contacted.
IMHO, SSDP and UPnP and bloated and overly complicated for resource discovery... but hey, it's a standard. ;)
看来您需要的是简单服务发现协议或SSDP。 这是在 Windows 中实现的,作为 Microsoft 对通用即插即用支持的一部分。 由于这是一个行业标准协议,因此这似乎是一个不错的选择。 例如,如果您想处理防火墙或其他问题,其他人已经解决了这个问题,而不必您自己推出解决方案。
由于您正在谈论 .NET,我假设您使用的是 Windows。 有一个有点旧的文档(2001)描述了 Windows 的 C 风格 API 和 COM API,标题为 通用即插即用 (UPnP) 客户端支持。 COM API 由 UPNP.DLL 公开,SSDP 的 C 风格 API 由 SSDPAPI.DLL 公开。
UPNP 的 COM 风格 API 可能是你最好的选择。 因为 C# 可以为您包装 COM 对象并处理互操作。 我找不到任何将此 API 本地移植到 C# 或 .NET Framework 的地方。
Seems like what you need is the Simple Service Discovery Protocol or SSDP. This is implemented in Windows as part of Microsoft's support for Universal Plug and Play. Since this is an industry standard protocol, it seems like a good bet. For instance, if you want to deal with firewalls or other issues, this will have been figured out by others instead of you having to roll your own solution.
Since you are talking .NET I'll assume you are on Windows. There's a somewhat old document (2001) describing a C-style API and a COM API for Windows entitled Universal Plug and Play (UPnP) Client Support. The COM APIs are exposed by UPNP.DLL and the C-style APIs for SSDP are exposed by SSDPAPI.DLL.
The COM-style APIs for UPNP are probably your best bet. Since C# can wrap up COM objects for you and handle the interop. I could not find any place where this API has been ported to C# or the .NET Framework natively.
您还可以考虑 Apple 的 Bonjour,这是他们的 Zeroconf 实现。 它适用于 Mac、PC 和 Linux/BSD。
You might also consider Apple's Bonjour, which is their Zeroconf implementation. It's available for Mac, PCs, and Linux/BSD.
我在远程处理工作中发现的最佳解决方案是将服务器列表保留在客户端系统上的配置文件中并使其可更新。 不是最容易维护的,但是速度很快并且没有广播。
The best solution I have found in my remoting work was to keep the server list in a config file on the client systems and make it updateable. Not the easiest to maintain but was fast and no broadcasting.
由于最近的 MS 更新,我的多播 UDP 解决方案似乎不可靠。
My multicast UDP solution seems to be unreliable due to recent MS update.