eflorico
eflorico

Reputation: 3629

Share data in LAN

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.

Upvotes: 0

Views: 786

Answers (4)

John Sonmez
John Sonmez

Reputation: 7206

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.

Upvotes: 1

ephemient
ephemient

Reputation: 204808

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.

Upvotes: 3

ChrisF
ChrisF

Reputation: 137148

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.

Upvotes: 0

rmeador
rmeador

Reputation: 25704

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.

Upvotes: 1

Related Questions