Cliff
Cliff

Reputation: 11268

Android can't see devices on ".local" domain

I'm having an annoying issue with Android development. I have a webserver (Tomcat) running on my Macbook which is connected to the local network via wifi. I have my Sprint EVO connected to the same network using wifi. The only way I can connect to the Tomcat instance is by raw IP address. If I use the Macbook name with or without the ".local" domain suffix it does not recognize the host name. The emulator behaves the same way. My iPhone can resolve the host name as can the iPhone simulator. So, I'm thinking either this is a bug in the Android platform or I've missed/accidentally tweak some hidden config somewhere in both the emulator and the device? Any idea?

Upvotes: 8

Views: 7617

Answers (2)

Ben Butterworth
Ben Butterworth

Reputation: 28938

More than 10 years after this question was asked, it has now been added to Android. You can visit a .local domain name (mDNS domain) - I have a raspberry pi server (raspberrypi.local) running a python web server (python3 -m http.server) in my screenshot.

From the android docs:

Users can use the command adb shell ping6 HOSTNAME.local, where HOSTNAME is the hostname of a target device on the LAN, for example, adb shell ping6 ipad.local.

Useful reading

enter image description here

Upvotes: 2

Seth
Seth

Reputation: 46453

A .local domain suggests Bonjour, which Android doesn't speak natively. The Mac's name without '.local' is either an AFP name or a WINS name (if you've got samba turned on), which isn't going to help much either.

You'll need to set up a proper DNS server (maybe your wifi router will do it), or try one of the java zeroconf libraries as described here.

Upvotes: 8

Related Questions