out.addAnswer(host, 0);
DNSRecord answer = localHost.getDNS4AddressRecord(); if (answer != null) out.addAnswer(answer, 0); answer = localHost.getDNS6AddressRecord(); if (answer != null) out.addAnswer(answer, 0);
        public void run() {            try {                if (++count < 3) {                    if (debug > 1) System.out.println("JmDNS canceling service");                    // announce the service                    //long now = System.currentTimeMillis();                    DNSOutgoing out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA);                    for (int i=0; i < infos.length; i++) {                        ServiceInfo info = infos[i];                        out.addAnswer(new DNSRecord.Pointer(info.type, DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, ttl, info.getQualifiedName()), 0);                        out.addAnswer(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN, ttl, info.priority, info.weight, info.port, host.name), 0);                        out.addAnswer(new DNSRecord.Text(info.getQualifiedName(), DNSConstants.TYPE_TXT, DNSConstants.CLASS_IN, ttl, info.text), 0);                        out.addAnswer(host, 0);                    }                    send(out);                } else {                    // After three successful announcements, we are finished.                    synchronized (lock) {                        lock.notifyAll();                    }                    cancel();                }            } catch (Throwable e) {                e.printStackTrace();                close();            }        }