This library 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.
Features
- Lookup any DNS record type (A, AAAA, MX, SPF, SOA, SRV, etc.).
- Optionally speficy 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.
License Terms
You may not reverse engineer this library. 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
http://www.simpledns.com/dns-client-lib.aspx,
and/or to be mentioned in the credits of whatever you use it for, but neither is required.
Download
Download the latest version from http://www.simpledns.com/dns-client-lib.aspx