Query Records Asynchronously using the PointerRecord  class.

The following example demonstrates querying Pointer (Reverse Lookup) records, asynchronously, using the static method called GetPointerRecordsAsync(). When the method has finished executing, the call back method RetrievePointerRecord() will be called.

[C#]

using System;
using aspNetDns;
using aspNetDns.Records;
namespace consoleTest
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			string LookupRecord = "microsoft.com";
			PointerRecord.GetPointerRecordsAsync( LookupRecord,  new PointerRecordDelegate( RetrievePointerRecord) );
		}

		private static void RetrievePointerRecord(PointerRecord[] records)
		{
			if( records.Length > 0 )
			{
				foreach( PointerRecord r in records )
				{
					Console.WriteLine( r.PointerName);
				}
			}
			else
				Console.WriteLine( "No records were found.");

			Console.ReadLine();
		}
	}
}





 

[VB.NET]

Imports aspNetDns
Imports aspNetDns.Records
Module Module1

    Sub Main()

        Dim LookupRecord As String = "microsoft.com"
        PointerRecord.GetPointerRecordsAsync(LookupRecord, New PointerRecordDelegate(AddressOf RetrievePointerRecord))

    End Sub

    Private Sub RetrievePointerRecord(ByVal records() As PointerRecord)
        If records.Length > 0 Then
            Dim r As AddressRecord
            For Each r In records
                Console.WriteLine(r.PointerName)
            Next r
        Else
            Console.WriteLine("No records were found.")
        End If
        Console.ReadLine()
    End Sub


End Module