Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - 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 - Disconnecting from the Server


    (Page 3 of 5 )

    If the name was not sent, the socket is disconnected, because without the name a workstation cannot be identified and listed on the server user interface. 

    begin

    Connection.IOHandler.WriteLn('Workstation name not provided! Goodbye.');

    Connection.Disconnect;

    end;

    end;

    end;


    When a client or workstation is disconnecting from the server, several things need to happen. First, the server must disconnect the client, and second, it must update the server applications user interface. The tsDisconnect() procedure does exactly that:


    procedure TForm1.tsDisconnect(AContext: TIdContext);

    var

    aname:string;

    li:tlistitem;

    begin

    TLog.AddMsg(TMyContext(AContext).compname + ' is disconnected');

    aname:=TMyContext(AContext).compname;

    //find computer name on the list view and remove it

    li:=lv.findcaption(0,aname,true,true,true);

    if li <> nil then

    begin

    li.Selected:=true;

    li.Delete;

    end;

    end;


    The first line of the procedure updates the memo component of the server using TLog’s AddMessage procedure. As you may recall, this procedure is created specifically to update the memo component to prevent the main thread from trying to update the component itself. So, if a client disconnects, you will see a visual confirmation of this both on the memo and on the list view components:


    TLog.AddMsg(TMyContext(AContext).compname + ' is disconnected');


    The second line stores the name of the disconnecting client in a string variable called “aname”:


    aname:=TMyContext(AContext).compname;


    Then it uses the list views findcaption() function to search for the name of the client on the list. This is because we want to remove the name of the disconnecting client from the visually:


    li:=lv.findcaption(0,aname,true,true,true);


    The findcaption() function returns either a nil value or a value greater than nil. If the value is not nil, then it means that the name has been found on the list and it will then remove the name using the delete() property of the list view component:


    if li <> nil then

    begin

    li.Selected:=true;

    li.Delete;

    end;

    end;


    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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek