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?
The domain name . local is a special-use domain name reserved by the Internet Engineering Task Force (IETF) so that it may not be installed as a top-level domain in the Domain Name System (DNS) of the Internet. As such it is similar to the other special domain names, such as . localhost.
According to Google, the Android DNS resolver supports mDNS . local resolution starting from November 2021. mDNS resolution is “transparently supported” by Android, according to the documentation.
Localhost is a hostname that refers to the local machine currently making the request. On many computers, localhost is an alias for the IP address 127.0. 0.1. When a computer pings this IP address, it is communicating with itself.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With