if ((q.type == TYPE_A) || (q.type == TYPE_ANY)) { out.addAnswer(in, new DNSRecord.Address(info.name, TYPE_A, CLASS_IN | CLASS_UNIQUE, 60, info.getIPAddress())); }
    synchronized void handleQuery(DNSIncoming in) throws IOException    {	DNSOutgoing out = null;	// answer relevant questions	for (Enumeration e = in.questions.elements() ; e.hasMoreElements() ;) {	    DNSQuestion q = (DNSQuestion)e.nextElement();	    switch (q.type) {	      case TYPE_PTR:		// find matching services		for (Enumeration s = services.elements() ; s.hasMoreElements() ; ) {		    ServiceInfo info = (ServiceInfo)s.nextElement();		    if (q.name.equals(info.type)) {			if (out == null) {			    out = new DNSOutgoing(FLAGS_QR_RESPONSE | FLAGS_AA);			}			out.addAnswer(in, new DNSRecord.Pointer(info.type, TYPE_PTR, CLASS_IN, 60, info.name));		    }		}		break;	      default:		// find service		ServiceInfo info = (ServiceInfo)services.get(q.name);		if (info != null) {		    if (out == null) {			out = new DNSOutgoing(FLAGS_QR_RESPONSE | FLAGS_AA);		    }		    if ((q.type == TYPE_SRV) || (q.type == TYPE_ANY)) {			out.addAnswer(in, new DNSRecord.Service(info.name, TYPE_SRV, CLASS_IN | CLASS_UNIQUE, 60, info.priority, info.weight, info.port, info.name));		    }		    if ((q.type == TYPE_TXT) || (q.type == TYPE_ANY)) {			out.addAnswer(in, new DNSRecord.Text(info.name, TYPE_TXT, CLASS_IN | CLASS_UNIQUE, 60, info.text));		    }		    if ((q.type == TYPE_A) || (q.type == TYPE_ANY)) {			out.addAnswer(in, new DNSRecord.Address(info.name, TYPE_A, CLASS_IN | CLASS_UNIQUE, 60, info.getIPAddress()));		    }		}	    } 	}	if ((out != null) && (out.numAnswers > 0)) {	    send(out);	}    }