Allows applications to resolve domain names by using the Domain Name System Protocol (DNS).

      Syntax

      public class DnsClient : Component

      Examples

      Shows how to look up for DNS records by host address.

      using System;
      using System.Windows.Forms;
      using ComponentPro.Net;
      
      ...
      
      // Create a new DnsClient object.
      DnsClient client = new DnsClient();
      // Retrieve all resource records.
      DnsQueryMessage replyMessage = client.Lookup("gmail.com", DnsRecordType.ALL);
      
      if (replyMessage != null)
      {
          if (replyMessage.Answers.Count > 0)
          {
              Console.WriteLine("Answer Records:");
              foreach (IDnsResourceRecord r in replyMessage.Answers)
              {
                  Console.WriteLine("  " + r.ToString());
              }
          }
      
          if (replyMessage.Authorities.Count > 0)
          {
              Console.WriteLine("");
              Console.WriteLine("Authority Records:");
              foreach (IDnsResourceRecord r in 
                  replyMessage.Authorities)
              {
                  Console.WriteLine("  " + r.ToString());
              }
          }
      
          if (replyMessage.AdditionalRecords.Count > 0)
          {
              Console.WriteLine("");
              Console.WriteLine("Additional Records:");
              foreach (IDnsResourceRecord r in 
                  replyMessage.AdditionalRecords)
              {
                  Console.WriteLine("  " + r.ToString());
              }
          }
      }

      Inheritance Hierarchy

               ComponentPro.Net.ComponentPro.Net.DnsClient

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Dns.CF (in ComponentPro.Dns.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Dns (in ComponentPro.Dns.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.Dns.Android (in ComponentPro.Dns.Android.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.Dns.iOS (in ComponentPro.Dns.iOS.dll)

      See Also