@Override
	public void run() {
		DNSPacket dnsMessage = new DNSPacket(true);
		dnsMessage.setAuthoritativeAnswer(true);

		List<ServiceInfo> removalList = new LinkedList<ServiceInfo>();
		
		boolean bannouncedLocalInfo = false;
		
		if(_LocalInfo.getState().isAnnouncing())
		{
			synchronized(_LocalInfo) {
				addLocalInfoRecord(dnsMessage);
			}
			
			bannouncedLocalInfo = true;
		}
            
        if(_AnnounceList != null && _AnnounceList.size() > 0) {
	        for (ServiceInfo info : _AnnounceList)
	        {
	        	synchronized(info) {
		            dnsMessage.addAnswer(new DNSRecord.Pointer(info.getType(), DNSEntry.EntryType.PTR, 
		            	DNSEntry.EntryClass.IN, DNSEntry.TTL, info.getQualifiedName()));
//		            dnsMessage.addAnswer(new DNSRecord.Pointer("_services._dns-sd._udp.local.", DNSEntry.EntryType.PTR, 
//			            	DNSEntry.EntryClass.IN, false, DNSConstants.DNS_TTL, info.getType()));
		            dnsMessage.addAnswer(new DNSRecord.Service(info.getQualifiedName(), 
		            	DNSEntry.EntryClass.IN, true, DNSEntry.TTL, info.getPriority(), info.getWeight(), 
		            	info.getPort(),_LocalInfo.getName()));
		            if(info.getTextBytes() != null) {
			            dnsMessage.addAnswer(new DNSRecord.Text(info.getQualifiedName(),
			            	DNSEntry.EntryClass.IN, true, DNSEntry.TTL, info.getTextBytes()));
		            }
		            info.advanceState();
		            if(info.getState().isAnnounced())
		            	removalList.add(info);
	        	}
	        }
	        
	        // If we haven't announced local information, announce it now, since some service depends on it.
	        if(!bannouncedLocalInfo)
	        	addLocalInfoRecord(dnsMessage);
        }
        
        for(ServiceInfo info : removalList)
        	_AnnounceList.remove(info);        	
        
        if(dnsMessage.getAnswers().size() > 0)
        	_Socket.send(dnsMessage);
        else
        	cancel();
	}