Delphi-Kylix
  Home arrow Delphi-Kylix arrow Finishing the Client for an Internet Acces...
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

Finishing the Client for an Internet Access Control Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-10-06

    Table of Contents:
  • Finishing the Client for an Internet Access Control Application
  • Check the ini file
  • Code Explained
  • The Timer Window

  • 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


    Finishing the Client for an Internet Access Control Application


    (Page 1 of 4 )

    Last week we began our discussion of the client side of an Internet access control program. This week we'll continue to cover the important parts of the code. We'll start with the reading thread, then go to the ini file. Keep reading to be enlightened.

    The reading thread listens for any communication from the server. It will wait for commands from the server for as long as the client is connected and then pass any communication on to the synchronization functions for processing. Here is the code:

    constructor TReadingThread.Create(AConn: TIdTCPConnection);

    begin

    FConn := AConn;

    inherited Create(False);

    end;


    procedure TReadingThread.Execute;


    begin

    while not Terminated and FConn.Connected do

    begin

    TLog.AddMsg(FConn.IOHandler.ReadLn);

    end;

    end;


    //**********end message sync functions






    procedure TForm1.btnExitClick(Sender: TObject);

    begin

    close;

    end;

    When the client is connected, the reading thread is activated and set up:


    procedure TForm1.tcConnected(Sender: TObject);

    begin

    rt := TReadingThread.Create(tc);

    end;


    procedure TForm1.btnDisconClick(Sender: TObject);

    begin

    tc.Disconnect;

    end;


    One of the many actions that is carried out when the client connects is implemented here. First, the client sends over its name and IP address. The btnConnect procedure shows how it is done in code:

    procedure TForm1.btnConnectClick(Sender: TObject);

    begin

    tc.Host:='127.0.0.1';

    tc.Port:=1150;

    with tc do

    begin

    try

    Connect;

    Socket.WriteLn(edname.text+':free@plchldr');

    //Socket.WriteLn(GetComputername+':free@plchldr');

    except on E : Exception do

    showmessage('Could not connect to remote host. Check to see if you entered the right IP address');

    end;

    end;

    end;


    procedure TForm1.tcDisconnected(Sender: TObject);

    begin

    if rt <> nil then

    begin

    rt.Terminate;

    rt.WaitFor;

    FreeAndNil(rt);

    end;

    end;


    procedure TForm1.oneClick(Sender: TObject);

    var

    mins:widestring;

    begin

    mins:='5'; {

    form1.Visible:=false;

    form2.times:=strtoint(mins);

    form2.label1.caption:=mins;

    form2.show; }

    //wb.Navigate(path);

    end;

    More Delphi-Kylix Articles
    More By David Web


     

    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 4 hosted by Hostway
    Stay green...Green IT