ComponentSpace DNS Class Library

DNS Class Library

Introduction provides an overview of the DNS Class Library.

Installation details the prerequisite system requirements and installation procedures for the DNS Class Library.

Reference documents the namespaces and classes that constitute the DNS Class Library.

Examples describes the included example code.

FAQ lists frequently asked questions.

Support describes how to get support.

Send comments on this topic.


Introduction

Query DNS servers for MX and all the other resource record types defined by RFC-1034 and RFC-1035. The DNS .NET class library makes it easy to retrieve the list of configured DNS servers, construct a DNS query request using the convenient message and resource record classes, send the request to a DNS server and receive the fully parsed response. Written in 100% managed C# code, the class library offers .NET developers complete access to DNS resources from within their applications.

The DNS .NET class library may be used in any Windows or Web application by adding a reference to the assembly to access the classes in the ComponentSpace.Dns namespace.

Convenient and very simple to use methods are provided to perform the most common DNS operations including DNS forward and reverse lookups. Alternatively, for greater flexibility, you may constuct your own DNS request and process the DNS response.

The DnsMessage class models DNS request and response messages. It makes it very easy to construct DNS requests and access DNS responses. A separate class describes each resource record type. Each resource record class is derived from the ResourceRecord abstract class.

The list of resource record classes includes:

  • ARecord
  • CNAMERecord
  • HINFORecord
  • MBRecord
  • MDRecord
  • MFRecord
  • MGRecord
  • MINFORecord
  • MRRecord
  • MXRecord
  • NSRecord
  • NULLRecord
  • PTRRecord
  • SOARecord
  • TXTRecord
  • WKSRecord
  • A catch all OtherRecord

The DnsClient class allows you to send DnsMessage requests and receive DnsMessage responses. Within the DnsMessage request you specify the DNS questions to ask. The DnsMessage response contains the lists of ResourceRecords.

You may send requests from within DnsClient either synchronously (blocking) using the Send method or asynchronously (non-blocking) using the BeginSend and EndSend methods. Similarly, responses may be received either synchronously (blocking) using the Receive method or asynchronously (non-blocking) using the BeginReceive and EndReceive methods. For asynchronous calls you may receive completion notification either through an event or a callback method. A timeout may be specified.

All classes that raise events support a SynchronizingObject property. All classes report errors through the DnsException.

Features

  • Supports RFC-1034/RFC-1035
  • Simple to use DNS forward and reverse lookup methods
  • No complicated DNS message construction or parsing
  • Specify the resource types to retrieve including all
  • Retrieve the list of configured DNS servers
  • Calling applications may make either synchronous or asynchronous calls
  • Asynchronous calls may either use events or callbacks
  • Specify a timeout
  • 100% managed code written in C#
  • Object oriented design specifically for the .NET framework
  • All error handling through .NET exceptions
  • Comprehensive Visual Studio .NET style documentation
  • VB.NET and C# example source code
  • Includes prompt free email support
  • Royalty free runtime
  • Source code available

This class library may also be purchased as part of the ComponentSpace .NET Internet Suite.

Getting Started

  • Install the product in your development environment.
  • Compile and run one of the examples.
  • Refer to the reference section for further details.
  • Add a reference to the class library in your application.
  • Once completed, distribute the class library with your application.


Installation

To install this product double click the .MSI file and follow the installation steps.

Prerequisites

The Microsoft .NET framework runtime must already be installed on your computer. The Microsoft .NET framework redistributable may be downloaded from msdn.microsoft.com.

You will also need a development environment such as Visual Studio .NET.

Distribution

The class library's runtime is royalty free which means it may be freely distributed with your application. The only file that should be distributed is the class library's DLL.


Reference

The reference section is contained within a separate help file.


Examples

Example code, developed using Microsoft Visual Studio .NET, is included with the product. You will find these projects in sub-directories of the installation directory.

VBDnsLookup
Demonstrates the use of the class library to perform DNS forward and reverse lookups within a VB application. This example uses synchronous invocation.
DnsQuery
Demonstrates the use of the class library within a C# application. This example uses asynchronous invocation with event notification.
VBDnsQuery
Demonstrates the use of the class library within a VB application. This example uses asynchronous invocation with event notification.


FAQ

Frequently Asked Questions
  1. I can't build the examples. Why can't the ComponentSpace namespace be found?

    2. The assembly containing the namespace or the project referencing it has been moved. The simplest way to fix this is to re-add the reference to the project by browsing to where the DLL is located (typically the installation directory).

  2. What is DNS?

    3. The Domain Name Service Protocol (DNS) defines a message format for accessing domain name information stored on a server. It is defined by RFC-1034, RFC-1035 and related RFCs.

  3. What if I'm behind a firewall?

    4. Outgoing UDP traffic to port 53 (the default DNS port) must be permitted. You may need to talk to your network administrator.

  4. Do you support DNS server updates?

    5. No, currently only queries are supported.

  5. Why am I getting an error trying to retrieve DNS information?

    6. Make sure the DNS server address is valid and that you can connect to it. Ensure the domain name you're querying is valid and exists.


Support

For further information, visit us at http://www.componentspace.com or send email to info@componentspace.com.

If have a bug to report or a product enhancement request send email to support@componentspace.com.