DNSLookup class looks up a record on a given DNS Server. If you want to do simple DNS lookup, take a look at SimpleDNSLookup class. The lookup is performed when the class is constructed.
For a list of all members of this type, see DNSLookup Members.
System.Object
Lavantech.Dns.DNSLookup
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Here is an example where the class is used to get all IP Address (A Record) for www.hotmail.com.
using System; using Lavantech.Dns; class TestApp { public static void Main() { // QTYPE_A asks for the ARecord(Address Record). // QCLASS_IN is for Internet class. // null is passed for server name. If null is passed the name server setting of the system is used. DNSLookup dnsLookup = new DNSLookup("www.hotmail.com", DNSLookup.QTYPE_A, DNSLookup.QCLASS_IN, 1000, null); // Get all Answer Records. ResourceRecord[] records = dnsLookup.GetAnswerRecords(); // Print all the Address Records. for(int i=0; i < records.Length; i++) if(records[i] is ARecord) Console.WriteLine(((ARecord)records[i]).GetIPAddress().ToString()); } }
Namespace: Lavantech.Dns
Assembly: dnscomponent (in dnscomponent.dll)
DNSLookup Members | Lavantech.Dns Namespace | SimpleDNSLookup