局域网内共享数据

发布于 2024-08-07 19:03:52 字数 76 浏览 4 评论 0原文

我正在构建一个音乐库程序,我希望能够在局域网中共享该库。我如何发现共享其图书馆的其他人?我想找到其他人的库,而无需输入 IP 之类的东西。

I'm building a music library program, and I want to have the ability to share the library in the LAN. How can I discover others who share their library? I'd like to find others' libraries without typing in IPs and stuff.

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

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

发布评论

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

评论(4

つ可否回来 2024-08-14 19:03:52

Apple 使用 mdns(他们称之为 Bonjour)在本地网络上广播和发现音乐共享,无需任何用户配置。

许多其他制造商也实现了UPnP/AV

Apple uses mdns (they call it Bonjour) to broadcast and discover music shares on the local network without any user configuration.

Many other manufacturers implement UPnP/AV for the same.

放我走吧 2024-08-14 19:03:52

也许最简单的方法是使用 UDP 定期向 发送消息(包含一些宣传您的图书馆存在的信息)广播地址。这将被您子网上的所有主机接收(也许还会被进一步接收,具体取决于您的路由器配置)。如果您的应用程序侦听来自其他主机的这些消息,随着时间的推移,它将能够找到您的应用程序在子网上的所有其他实例。

编辑:找到这个问题,其中包含更多内容的答案我正在谈论的具体内容。

Probably the easiest way is to use UDP to periodically send a message (containing some info advertising your library's presence) to the broadcast address. This will be received by all the hosts on your subnet (and perhaps further, depending on your router configuration). If your app listens for these messages from other hosts, it will over time be able to find all the other instances of your app on the subnet.

Edit: found this question which has answers that go into more specifics of what I'm talking about.

国粹 2024-08-14 19:03:52

SNMP

该协议是为您想要做的事情而设计的。
您可以使用多个库来实现 SNMP,这将使发送和接收变得容易。

SNMP

This protocol was designed for what you are looking to do.
There are several libraries that you could use that implement SNMP which would make it easy to send and receive.

櫻之舞 2024-08-14 19:03:52

您可以让您的应用程序发送该库共享到中央服务器的事实 - 实际上只是发送位置。

然后,应用程序的其他实例可以只向服务器询问共享库的列表。

这样做的优点是您的应用程序不会持续广播。

缺点是需要一个中央服务器。

You could get your application to send the fact that the library is shared to a central server - in fact just send the location.

Other instances of your application could then just ask the server for the list of shared libraries.

The advantage of this is that your application isn't constantly broadcasting.

The disadvantage is that you need a central server.

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