Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 4 - Creating a WHOIS Lookup Client
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Creating a WHOIS Lookup Client
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2006-09-18

    Table of Contents:
  • Creating a WHOIS Lookup Client
  • DNS Resolution
  • The Program
  • Entire Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating a WHOIS Lookup Client - Entire Code


    (Page 4 of 4 )

    For your convenience, here is the entire code for the program, all in one place.

    unit main;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics,
    Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, IdTCPConnection, IdTCPClient,
    IdWhois,
      IdBaseComponent, IdComponent, IdTCPServer, IdWhoIsServer,
    IdDNSResolver,
      IdCustomTCPServer, ComCtrls, Buttons;
    type
      TForm1 = class(TForm)
        Panel2: TPanel;
        IdWhoIsServer1: TIdWhoIsServer;
        IdWhois1: TIdWhois;
        IdDNSResolver: TIdDNSResolver;
        Panel3: TPanel;
        Panel4: TPanel;
        hname: TEdit;
        cb: TComboBox;
        Panel5: TPanel;
        g_info: TBitBtn;
        StaticText1: TStaticText;
        StaticText2: TStaticText;
        Memo1: TMemo;
        lv: TListView;
        hostnme: TEdit;
        StaticText3: TStaticText;
        resolve: TBitBtn;
        StatusBar1: TStatusBar;
        dns: TEdit;
        StaticText4: TStaticText;
        StaticText5: TStaticText;
        procedure g_infoClick(Sender: TObject);
        procedure resolveClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        li:tlistitem;
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.g_infoClick(Sender: TObject);
    begin
    memo1.Clear;
    //label1.Caption:='Connected';

     with IdWhois1 do begin
        Host :=cb.text;
        memo1.Lines.Text := whois(trim(hname.text));
     end;

    //idWhois1.Disconnect;

    end;

    procedure TForm1.resolveClick(Sender: TObject);
    var
      Count:     Integer;
      DNSServer: String;
      HostName:  String;
      I:         Integer;
    begin
      Memo1.Lines.Clear;
      DNSServer:=dns.Text;
      HostName:=hostnme.Text;
      if (DNSServer='')or(HostName='') then
      begin
        Memo1.Lines.Add('*** Error ***');
        if DNSServer='' then
          Memo1.Lines.Add('DNS Server is empty.');
        if HostName='' then
          Memo1.Lines.Add('Host name is empty.');
        Exit;
       end;
      IdDNSResolver.Host:=DNSServer;
       IdDNSResolver.QueryType:=[qtA];
     IdDNSResolver.Resolve(HostName);
      Count:= IdDNSResolver.QueryResult.Count;
      if Count=0 then Exit;
      for I:=0 to Count-1 do
      begin
            if  IdDNSResolver.QueryResult.Items[I] is TARecord then
        li:=lv.Items.Add;
          with TARecord( IdDNSResolver.QueryResult[I]) do   begin
           //Memo1.Lines.Add(ClassName+': '+Name+' resolves to IP
    address '+IPAddress);
          li.Caption:=Name;
        li.SubItems.Add(IPaddress);
        end;
        end;
       end;
    end.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · I hope you found my article educational; I welcome your comments.
     

    DELPHI-KYLIX ARTICLES

    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT