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 class 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.
Initialize
Initialize an instance of the class, loading the networking library and
validating the development license. This method must be called before
any properties are changed or any other methods in this class are called
by the application.
Reset
Reset the internal state of the class 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.
Uninitialize
Unload the networking library and release any resources that have been
allocated for the class instance. This method is automatically invoked
when the class instance is disposed or goes out of scope.
When resolving a host name or IP address, the class will first search the local system's host table, a file that is used to map host names to addresses. The hosts file is found in C:\Windows\system32\drivers\etc\hosts. Note that the file does not have an extension.
HostFile
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 class 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 class will search the local
system's host table first, and then perform a nameserver query if
required.
HostAddress
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 class 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.
HostName
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 class 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.
Resolve
A method which resolves a host name into an IP address, returned as a
string in dotted notation. The class 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.
Query
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.
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 joe@example.com, 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 example.com. A domain may have more than one mail server, in which case multiple MX records will be returned.
MailExchange
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 class can be used to perform advanced queries for other types of records.
HostInfo
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.
HostServices
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.
NameServer
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 class is four.