Test ARSoft.Tools.Net with Dnsbenchmark

Aug 6, 2012 at 10:58 AM

I build a dns server with ARSoft.Tools.Net, and I test it by DnsBenchMark( http://www.grc.com/dns/benchmark.htm). But Dnsbenchmark response that "Dns lookup is not offered by this server". Is there anybody tell me why? 

      I test the server by nslookup,It can works.

Coordinator
Aug 6, 2012 at 8:31 PM

Can you please provide some more information about the implementation you are using?

Aug 7, 2012 at 2:28 AM
AlexReinert wrote:

Can you please provide some more information about the implementation you are using?

Almost the same as the sample "Really simple forwarding server".

Coordinator
Aug 7, 2012 at 6:04 AM

Try this code:

static DnsMessageBase ProcessForwaringQuery(DnsMessageBase message, IPAddress clientAddress, ProtocolType protocol)
{
	message.IsQuery = false;
 
	DnsMessage query = message as DnsMessage;
 
	if ((query != null) && (query.Questions.Count == 1))
	{
		// send query to upstream server
		DnsQuestion question = query.Questions[0];
		DnsMessage answer = DnsClient.Default.Resolve(question.Name, question.RecordType, question.RecordClass);
 
		// if got an answer, copy it to the message sent to the client
		if (answer != null)
		{				
			foreach (DnsRecordBase record in (answer.AnswerRecords))
			{
				query.AnswerRecords.Add(record);
			}
			foreach (DnsRecordBase record in (answer.AdditionalRecords))
			{
				query.AnswerRecords.Add(record);
			}
			foreach (DnsRecordBase record in (answer.AuthorityRecords))
			{
				query.AuthorityRecords.Add(record);
			}
 
			query.ReturnCode = answer.ReturnCode;
			query.IsRecursionAllowed = true;
			return query;
		}
	}
 
	// Not a valid query or upstream server did not answer correct
	message.ReturnCode = ReturnCode.ServerFailure;
	return message;
}
Aug 7, 2012 at 6:22 AM

It works,Thx!