网络设备发现

发布于 2024-11-25 20:33:23 字数 377 浏览 3 评论 0原文

对于我的 Android 应用程序,用户需要连接到托管在同一 LAN 上某处的服务器。同一 LAN 上可以托管多个服务器。为了方便用户,我打算扫描 Android 设备当前连接的 LAN,然后列出所有运行服务器的网络设备,而不是让用户将 IP 输入到计算机上手动。

我对网络相当陌生,经过一番搜索后,我发现我必须使用多播 DNS 搜索或 UDP 广播来检测其他设备。我还发现了一个名为 jmDNS 的不错的库,尽管我在它上面发现的文档和示例代码很少。有人可以为我指出正确的方向,以节省我浪费的时间(主要是如果我走在正确的轨道上)吗?我假设我必须稍微修改我的服务器才能在那里广播它?如果我将 IP 手动输入到我的应用程序的配置页面中,它会完全按预期工作。另外,这只需要发现 Windows 计算机,不确定这是否重要。提前致谢。

For my Android app, users need to connect to a server that will be hosted somewhere on the same LAN. There can be multiple servers hosted on the same LAN. To make it easy for the user, I was going to scan the current LAN that the Android device is connected to and then list all of the network devices that have the server running on it, rather than having the user input the IP to the computer manually.

I'm fairly new to networking, and after some searching I found out that I would have to use a multi-cast DNS search or UDP broadcast to detect the other devices. I also found a nice library called jmDNS, although I've found very few documentation and sample code on it. Could somebody point me in the right direction for what I'm trying to do to save me wasted time (mostly if I'm on the right track)? I'm assuming that I'll have to modify my server a bit to broadcast it's there? It works completely as intended if I input the IP manually into the configuration page on my app. Also, this only needs to discover Windows computers, not sure if that matters. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心如狂蝶 2024-12-02 20:33:23

嗯,jmDNS 是一个完整的 Java 库,您可以使用它来进行设置。它可用于广播您的服务以供其他客户搜索。

Windows 上的 Bounjour 服务有点棘手,尽管它绝对是可能的。我想说,更简单的方法是使用 jmDNS 为服务器和客户端进行广播和发现。

Well, jmDNS is a complete Java library that you could use for your setup. It can be used to braodcast your services which other clients can search for.

Bounjour service on windows is a bit tricky, although it's definitely possible. The easier way, I would say is to use jmDNS for broadcast and discovery for both your servers and clients.

一向肩并 2024-12-02 20:33:23

您可以将 jDM 或其他服务作为后台服务或守护进程在局域网上运行。

You would run the jDMs or other service on your local area network as a background service or a dameon.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文