Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 4 - Important Procedures 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 
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

Important Procedures 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-09-15

    Table of Contents:
  • Important Procedures for an Internet Access Control Application
  • Taking Names
  • Disconnecting from the Server
  • The tsExecute Procedure
  • Suggested Improvements

  • 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


    Important Procedures for an Internet Access Control Application - The tsExecute Procedure


    (Page 4 of 5 )

     

    The tsExecute procedure deals with any commands or request that a client sends over; so far in this implementation it only deals with the ‘timesup’ command. This command tells the server that the client has finished with the Internet session and that it is ready for another session to be allocated:


    procedure TForm1.tsExecute(AContext: TIdContext);

    var

    str,spacer,thename,cmd:string;

    li:tlistitem;

    begin

    str:=acontext.Connection.IOHandler.ReadLn;

    ParseString(str,cmd,thename,spacer);

    if cmd = 'timesup' then begin

    //search for workstation name in treeview and set its status to 'free'

    li:=lv.FindCaption(0,thename,true,true,true);

    if li <> nil then begin

    li.Selected:=true;

    li.ImageIndex:=0;

    li.SubItems.Strings[0]:='-';

    li.SubItems.Strings[1]:='-';

    li.SubItems.Strings[2]:='-';

    li.SubItems.Strings[3]:='-';

    li.SubItems.Strings[4]:='free';

    end;

    end;

    end;


    First the procedure reads the communication from the client into a string variable called “str”:


    str:=acontext.Connection.IOHandler.ReadLn;


    Then the string is parsed into three separate parts: the command, the name of the sender and a placeholder:


    ParseString(str,cmd,thename,spacer);


    Next the procedure checks to see what command has been sent. If the command is “timesup,” it continues to search for the name of the computer in the list of names in the list view, and then sets the status of that computer to “free.”


    //search for workstation name in treeview and set its status to 'free'

    li:=lv.FindCaption(0,thename,true,true,true);

    if li <> nil then begin

    li.Selected:=true;

    li.ImageIndex:=0;

    li.SubItems.Strings[0]:='-';

    li.SubItems.Strings[1]:='-';

    li.SubItems.Strings[2]:='-';

    li.SubItems.Strings[3]:='-';

    li.SubItems.Strings[4]:='free';

    More Delphi-Kylix Articles
    More By David Web


     

    DELPHI-KYLIX ARTICLES

    - Loading an XML Document into the DOM
    - 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...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek