1

I have trouble getting JmDNS up and running on Raspberry Pi device. The application works fine on all kinds of x86 Linuxes but when started on Raspberry (running "Raspbian GNU/Linux 8 (jessie)") services announced by it are invisible. Services announced by avahi-daemon (I start it manually) are visible so I guess there's a problem with the way JmDNS instance created

JmDNS dns = JmDNS.create(InetAddress.getLocalHost())
synapse
  • 5,588
  • 6
  • 35
  • 65

1 Answers1

1

I had what sounds like a similar problem, JmDNS was discovering and publishing services on my 2 laptops and phone, but not my Pi.

I fixed it by commenting out all the IP addresses listed in the /etc/hosts files. After that I was able to create a JmDNS instance.

Alternatively add a line to the /etc/hosts file such as:

192.167.0.12 raspberrypi

The IP address being the one you want to select (if you know it) and "raspberrypi" being the name of your SERVICE_NAME. You can then do:

InetAddress addr = InetAddress.getLocalHost();       
String hostname = InetAddress.getByName(addr.getHostName()).toString();
jmdns = JmDNS.create(addr, hostname);
Sam
  • 47
  • 2
  • 12
  • I did not understand how to use jmDNS to reply to respberrypi.local... can you please provide an example? – Tobia Nov 04 '16 at 11:54