Question

I am creating JmDNS service from other machine running windows-xp by

JmDNS dns = JmDNS.create("localhost"); 
dns.regesterService("_sreviceTest._tcp.local.", "Test-Service", 8765, "Description");

If I run other client which will resolve services, Created by JmDNS that finds it, irrespective of machine. But if i try to find same service through avahi-browse. It couldn't find it. and give following output.

avahi-browse -rv _sreviceTest._tcp
Server version: avahi 0.6.30; Host name: ubuntu.local
E Ifce Prot Name                                          Type                 Domain
+   eth0 IPv4 Test-Service                                _sreviceTest._tcp local
Failed to resolve service 'Test-Service' of type '_serviceTest._tcp' in domain 'local': Timeout reached
Was it helpful?

Solution

It is a bug in JmDNS version 3.4.1 library. See for detail BUG

this.service_type = "_ros-master._tcp.local.";
this.service_name = "RosMaster";
this.service_port = 8888;
String service_key = "description"; // Max 9 chars
String service_text = "Hypothetical ros master";
HashMap<String, byte[]> properties = new HashMap<String, byte[]>();
properties.put(service_key, text.getBytes());
// service_info = ServiceInfo.create(service_type, service_name, service_port); // case 1, no text
// service_info = ServiceInfo.create(service_type, service_name, service_port, 0, 0, true, service_text); // case 2, textual description
service_info = ServiceInfo.create(service_type, service_name, service_port, 0, 0, true, properties); // case 3, properties assigned textual description
jmdns.registerService(service_info);

Case 1 and case 2 create services detectable by avahi, but they fail to resolve.
Case 3 works fine.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top