Domain Name Service  

The Domain Name Service (DNS) protocol is what applications use to resolve domain names into Internet addresses, as well as provide other information about a domain, such as the name of the mail servers which are responsible for receiving email for users in that domain. All of the SocketTools components provide basic domain name resolution functionality, but the Domain Name Services control gives an application direct control over what servers are queried, the amount of time spent waiting for a response and the type of information that is returned.

The following properties, methods and events are available for use by your application:

Initialize the control and validate the runtime license key for the current process. This method is normally not used if the control is placed on a form in languages such as Visual Basic. However, if the control is being created dynamically using a function similar to CreateObject, then the application must call this method to initialize the component before setting any properties or calling any other methods in the control.

Reset the internal state of the control and re-initialize the component to use the default nameserver configuration for the local host. This can be useful if your application wishes to discard any settings made by a user and return to using the local system configuration.

Unload the Windows Sockets library and release any resources that have been allocated for the current process. This is the last method call that the application should make prior to terminating. This is only necessary if the application has previously called the Initialize method.

Host Tables

When resolving a host name or IP address, the library will first search the local system's host table, a file that is used to map host names to addresses. On Windows 95/98 and Windows Me, if the file exists it is usually found in C:\Windows\hosts. On Windows NT and later versions, it is found in C:\Windows\system32\drivers\etc\hosts. Note that the file does not have an extension.

Return the full path of the file that contains the default host table for the local system. This can be useful if you wish to temporarily switch between the default host file and another host file specific to your application.

Host Name Resolution

The control can be used to resolve host names into IP addresses, as well as perform reverse DNS lookups converting IP addresses into the host names that are assigned to them. The control will search the local system's host table first, and then perform a nameserver query if required.

A property which returns the IP address of the host name specified in the HostName property. Setting this property to an IP address will cause the control to perform a reverse DNS lookup to attempt to determine the name of the host that was assigned that address. If successful, the host name for the specified IP address can be determined by reading the value of the HostName property.

A property which returns the name of the host associated with the IP address specified in the HostAddress property. Setting this property to a host name will cause the control to perform a DNS lookup to determine the IP address of that host. If successful, the IP address for the host can be determined by reading the value of the HostAddress property.

A method which resolves a host name into an IP address, returned as a string in dotted notation. The control first checks the system's local host table, and if the name is not found there, it will perform a nameserver query for the A (address) record for that host.

Perform a general nameserver query for a specific record type. This method can be used to perform queries for the common record types such as A and PTR records, as well as for other record types such as TXT (text) records. Refer to the Technical Reference for more information about the specific types of records that can be returned.

Mail Exchange Records

When a system needs to deliver a mail message to someone, it needs to determine what server is responsible for accepting mail for that user. This is done by looking up the mail exchange (MX) record for the domain. For example, if a message was addressed to, to determine the name of the mail server that would accept mail for that recipient, you would perform an MX record query against the domain A domain may have more than one mail server, in which case multiple MX records will be returned.

A property array which returns the mail exchanges for the domain specified in the HostName property. This is a zero-based array, with the maximum number of entries returned by the MailExchanges property

Advanced Properties

In addition to providing host name and IP address resolution, the control can be used to perform advanced queries for other types of records.

Return additional information about the specified host name. If the name server has been configured to provide host information for the domain, this method will return that data. Typically it is used to indicate what hardware and operating system the host uses.

Return information about the UDP and TCP based services that the host provides. If defined, this will return a list of service names such as "ftp" and "http". Note that your application should not depend on this information to be a definitive list of what services a server provides.

A property array which can be used to return the current nameservers that are configured for the local host, or the values can be changed to specify new nameservers. The maximum number of nameservers that can be configured for each instance of the control is four.