Simple DNS Plus
menubar Skip Navigation Links
Product Details

DNS Client Library for .NET

This library (JH Software's DNS Client Library for .NET) is a freeware component that can be used to perform simple as well as advanced DNS lookups from any .NET code (.NET v. 2.0 or later) against any standard based DNS server.

The .NET framework system.Net.Dns class does provide methods to do basic forward and reverse DNS lookups (host name to IP address / IP address to host name), but it cannot lookup other record types (such as MX-records to locate e-mail servers), it does not allow you to specify which DNS servers to use or specify any options for how the lookup is performed, and it does not give you access to any of the DNS response flags and additional data.
This library fixes all that and more.


  • Lookup any DNS record type (A, AAAA, MX, SPF, SOA, SRV, etc.).
  • Optionally specify which DNS servers to query (default = DNS servers from local system config).
  • Optionally use EDNS0 / specify payload size (more efficient lookups with UDP packets larger than 512 bytes).
  • Optionally use DNS-0x20 (protect against Kaminsky bug / DNS spoofing).
  • Specify whether to request recursion or not (RD flag).
  • Specify request timeout and retry count.
  • Specify which port number to send queries to (default = 53).
  • Access to response details including responding server IP address, AA-flag (authoritative answer), RA-flag (recursion available), EDNS0, as well as individual DNS records (name, type, TTL, data) in answer, authority, and additional sections.
  • Synchronous and asynchronous (Begin.../End...) lookup methods.
  • Works with both IPv4 and IPv6 DNS servers.
  • Automatically switches from UDP to TCP when receiving truncated responses (TC flag).
  • Always uses random query ID and UDP origin port number (protect against Kaminsky bug / DNS spoofing).
  • Fully documented including intellisense in Visual Studio.
  • Convenient simplified methods for host (A/AAAA), reverse (PTR), and MX lookups.
  • Functions to encode/decode IDNs (Internationalized Domain Names).
  • Built on program code from Simple DNS Plus - tested by thousands of users for +10 years.
  • Freeware (see license terms below).

Programming Overview

The primary functions in this library are Lookup, LookupHost, LookupReverse, and LookupMX - all static methods of JHSoftware.DnsClient. Each of these functions have several of overloads, and each has an asynchronous version (Begin... / End...). The LookupHost, LookupReverse, LookupMX functions are used to lookup specific types of DNS records and only return basic data. The Lookup function can lookup any DNS record type and returns a detailed Response object.
For more details, see the help file - also included as a .chm file in the download.

Code Samples

Lookup e-mail servers (MX) for VB.NET  C#
Dim MXs = JHSoftware.DnsClient.LookupMX("")
For Each MX In MXs
   Console.WriteLine(MX.Preference & " " & MX.HostName)
   If MX.IPAddresses IsNot Nothing Then
      For Each IP In MX.IPAddresses
         Console.WriteLine(">>> " & IP.ToString())
   End If
Lookup IPv4 addresses for using specific DNS servers: VB.NET  C#
Dim Options = New JHSoftware.DnsClient.RequestOptions
Options.DnsServers = New System.Net.IPAddress() { _
               System.Net.IPAddress.Parse(""), _
Dim IPs = JHSoftware.DnsClient.LookupHost("", _
                                          JHSoftware.DnsClient.IPVersion.IPv4, _
For Each IP In IPs
Lookup SPF-records for (and check if DNS server offers recursion): VB.NET  C#
Dim Response = JHSoftware.DnsClient.Lookup("", _
Console.WriteLine("Recursion available: " & Response.RecursionAvailable)
For Each Record In Response.AnswerRecords
   Console.WriteLine(Record.Name & " " & _
                     Record.Type.ToString & " " & _
                     Record.TTL & " " & _
Do asynchronous lookup for VB.NET  C#
Sub Main()
   JHSoftware.DnsClient.BeginLookupHost("", _
                                        JHSoftware.DnsClient.IPVersion.IPv4, _
                                        Nothing, _
                                        AddressOf MyCallback, _
   REM do other stuff while waiting for lookup to complete...
End Sub

Sub MyCallback(ByVal ar As IAsyncResult)
   Dim IPs = JHSoftware.DnsClient.EndLookupHost(ar)
   For Each IP In IPs
End Sub

License Terms

This software is provided to you free of charge (freeware). You may not reverse engineer it or pass it on as your own as your own creation, but otherwise you are free to use it, include it with other products and services, and distribute it through any media in any way you like. We would of course appreciate a link back to this page page, and/or to be mentioned in the credits of whatever you use it for, but neither is required.


Download JH Software's DNS Client Library for .NET v. 1.0 build 1 (October 29th 2009):

Download (269 KB)

Release Notes

Version 1.0 build 1 - October 29th 2009
- First release.

Copyright © 1999-2016 JH Software ApS. All Rights Reserved.
E-mail questions to
Terms of Use | Privacy Statement | Return Policy | About Us