out.addAnswer(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.priority, info.weight, info.port, host.name), 0);
out.addAnswer(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.priority, info.weight, info.port, localHost.getName()), 0);
        public void run() {            DNSOutgoing out = null;            try {                // send probes for JmDNS itself                if (state == taskState) {                    if (out == null) {                        out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA);                    }                    out.addAnswer(host, 0);                    advanceState();                }                // send announces for services                // Defensively copy the services into a local list,                // to prevent race conditions with methods registerService                // and unregisterService.                LinkedList list;                synchronized (JmDNS.this) {                    list = new LinkedList(services.values());                }                for (Iterator i=list.iterator(); i.hasNext(); ) {                    ServiceInfo info = (ServiceInfo) i.next();                    synchronized (info) {                        if (info.getState() == taskState && info.task == this) {                            info.advanceState();                            if (out == null) {                                out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA);                            }                            out.addAnswer(new DNSRecord.Pointer(info.type, DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.getQualifiedName()), 0);                            out.addAnswer(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.priority, info.weight, info.port, host.name), 0);                            out.addAnswer(new DNSRecord.Text(info.getQualifiedName(), DNSConstants.TYPE_TXT, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.text), 0);                        }                    }                }                if (out != null) {                    if (debug > 1) {                        System.out.println("JmDNS announcing #"+taskState);                    }                    send(out);                } else {                    // If we have nothing to send, another timer taskState ahead                    // of us has done the job for us. We can cancel.                    cancel();                }            } catch (Throwable e) {                e.printStackTrace();                close();            }                        taskState = taskState.advance();            if (! taskState.isAnnouncing()) {                cancel();            }        }