ActiveSocket Toolkit Add network capabilities to any Windows or .NET application

Quicklinks


DNS NsLookup using Borland Delphi

The Domain Name System (DNS) is the method by which Internet addresses in mnemonic form - such as www.activexperts.com - are converted into the equivalent numeric IP address such as 212.97.55.136. To the user and application process this translation is a service provided either by the local host or from a remote host via the Internet. The DNS server (or resolver) may communicate with other Internet DNS servers if it cannot translate the address itself.
DNS names are constructed hierarchically. The highest level of the hierarchy is the last component or label of the DNS address. Labels can be up to 63 characters long and are not case sensitive. A maximum length of 255 characters is allowed. Labels must start with a letter and can only consist of letters, digits and hyphens.

Nslookup is a popular program for UNIX, LINUX and Windows to query Internet domain name servers. It allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain.

ActiveSocket provides an easy-to-use development/scripting interface to use the same operations as NsLookup, through the DnsServer class. By using ActiveSocket, you can very easily create or enhance Windows applications/scripts with DNS lookup features.

ActiveSocket features the following: ICMP, HTTP and HTTPs (supporting for proxy servers, secure web sites), FTP, DNS, Telnet, NTP time protocol, RSH remote shell script interface, SNMP (Simple Network Management Protcol), SNMP Traps, Sockets, WOL (Wake-On-LAN), and more.

Step 1: Download and install the ActiveSocket Toolkit

Download the ActiveSocket from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a new Delphi Project

Launch Borland Delphi (for instance 'Delphi 2005') from the Start menu. Choose 'New' from the 'File' menu and select your preferred kind of application, for instance: 'VCL Forms Application - Delphi for Win32'. A new Form is displayed in the workspace.

Delphi

(Click on the picture to enlarge)

Step 3: Refer to the ActiveSocket Library and create the objects

Now that a new project has been created, you must add a reference to ActiveSocket in the project to be able to use the ActiveSocket object. To do so, choose 'Import Component...' from the 'Component' menu. The Import Components' dialog appears. Select 'Import a Type Library':

Borland Delphi

(Click on the picture to enlarge)

In the 'Registered Type Libraries' page, select 'ActiveSocket 2.4 Type Library' and click 'Next':

Borland Delphi

(Click on the picture to enlarge)

In the 'Components' page, leave all fields default and click 'Next':

Borland Delphi

(Click on the picture to enlarge)

In the 'Install' page, select 'Create Unit' and click 'Next':

Borland Delphi

(Click on the picture to enlarge)

The interface code is generated now and is shown in the ASOCKETLib_TLB tab of the project.

Step 4: Declare and create the object

From the Project Manager, open Unit1.bas and add the ASOCKETLib_TLB to the 'Uses' statement to refer to the ActiveSocket library:

Borland Delphi

(Click on the picture to enlarge)

In the 'private' or 'public' section, declare the following objects:

objFtpServer    : IFtpServer

You can now create the objects, for instance in the 'FormCreate' function:

objFtpServer     := TFtpServer.Create(Form1).DefaultInterface;