views:

260

answers:

5

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.

+1  A: 

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.

rmeador
Thanks a lot, I think this is the easiest solution. I knew about broadcasts but somehow I had in mind that they weren't forwarded by routers.. -.-
eWolf
A: 

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.

ChrisF
+3  A: 

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.

ephemient
In particular, Apple uses DAAP (http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol) to share things, using mdns for discovery.
Pete
+1  A: 

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.

John Sonmez
A: 

If u r using either cross over or pair to pair.................at first u should identify ip address in the from of 192.168.0.0 (in a individual form)"ip u dont konw how to put ip please mail me on [email protected] or vist my website www.shreejournalist.blogspot.com,.When u input ur IP then ping each other ,if ur networking is rite it would be pinged..................when u finished all things over........ 1)click start-Run 2)type other's ip address which u want to network,in a form of(\192.168.0.0),then user name and password will require please fill it up.........

ok if u have any confused please viste www.shreejournalist.blogpsot.com

Thank You

Shreekrishna Thapa