【问题标题】:avahi not able to find service creted by JmDNSavahi 无法找到 mDNS 创建的服务
【发布时间】:2012-09-25 11:04:53
【问题描述】:

我正在通过

从其他运行 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

【问题讨论】:

    标签: java linux ubuntu-12.04 jmdns avahi


    【解决方案1】:

    这是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.
    

    【讨论】:

      猜你喜欢
      • 2010-12-07
      • 1970-01-01
      • 2010-12-02
      • 2014-10-15
      • 1970-01-01
      • 2014-05-24
      • 1970-01-01
      • 2017-03-07
      • 2016-05-17
      相关资源
      最近更新 更多