1

我正在从其他运行 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
4

1 回答 1

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.
于 2012-10-04T15:04:47.070 回答