我正在通过
运行windows-xp的其他机器创建JmDNS服务JmDNS dns = JmDNS.create("localhost");
dns.regesterService("_sreviceTest._tcp.local.", "Test-Service", 8765, "Description");
如果我运行其他将解析服务的客户端,由发现它的JmDNS
创建,而不管机器如何。但是,如果我尝试通过avahi-browse
找到相同的服务。它找不到它。并给出以下输出。
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
答案 0 :(得分:2)
这是JmDNS version 3.4.1
库中的错误。有关详细信息,请参阅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.