Tuesday, August 25, 2009

JmDNS binds with 0.0.0.0 Interface

JmDNS is a java implementation to monitor and register the servers available in our LAN via multicast. It is a 'zeroconf' java implementation.
It is easy to use. We can simply add our own service types(need to register with dns-sd.org)and can use those services without any configuration at our network.
When we register the service we create a new jmdns object. It would be bounded with our interface(mostly our IP). Sometimes in windows it binds with 0.0.0.0 interface and DNS server discovers the service but not returns the service info. It states that service not found or service info is null.
We can overcome above issue while iterating all the interfaces available with the host and avoid
  • LocalAddress
  • MulticastAddress
  • LoopbackAddress
Finally bind with your valid interface.