Network Device Discovery
Asked Answered
A

2

9

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.

Allier answered 22/7, 2011 at 15:14 Comment(4)
Yup, mDNS is the probably the best way to go here. You'll need to install the Bonjour service on the Windows PCs though, as it's not natively supported there.Gerontology
By install, do you mean an actual installer (which could be a problem) or just adding the code to my server to make it support Bonjour?Allier
I think you could go the "add into your server" route, but it would be more work for you; so far, I've been using this installer from Apple instead: en.wikipedia.org/wiki/… (Mac OS and Linux have native support; I believe this service may be a part of the iTunes install, so the computer may already have this)Gerontology
Other relevant SO question that helped me with a similar problem: #4464707Thuja
P
7

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.

Phenology answered 22/7, 2011 at 17:50 Comment(0)
R
0

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

Ranzini answered 21/11, 2012 at 20:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.