Home arrow Delphi-Kylix arrow The Client for an Internet Access Control Application
DELPHI-KYLIX

The Client for an Internet Access Control Application


Recently we finished a series covering the server side for an Internet access control application; now we're ready to take on the client. The client application is what the Internet users will see shortly before a workstation is activated or when a session is completed. It is responsible for both time and user access management as you will see in the rest of the series. Crucially, it is also responsible for processing all communication between itself and the server.

Author Info:
By: David Web
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
September 29, 2008
TABLE OF CONTENTS:
  1. · The Client for an Internet Access Control Application
  2. · Small and Main Window
  3. · Disable Mouse and Keyboard Access
  4. · Retrieving the Workstation Name

print this article
SEARCH DEVARTICLES

The Client for an Internet Access Control Application
(Page 1 of 4 )

How does it work?

The client application will be running on the workstations and will be activated when these workstations are switched on. At some point in the series of articles, we will be creating a Windows service which will be responsible for activating the client application.

Once the client application is activated, it will automatically try to connect to the server application. If it is successful in doing so, it will send the computer name to the server; if it is not successful in its attempt to connect, a timer will be set to try connecting to the server every minute for as long as the client application is active. While all of the above is going on, the client application will block access to both the keyboard and mouse. Once the client application connects to the server, it will then wait for any requests or commands from the server for processing.

So, when the client application is started, it does the following:

  • Tries connecting to server every minute.

  • Blocks keyboard and mouse access.

  • Reads path to ads and set the path variable.

  • Activates browser control to show ads.

The server will send one of two communications:

session information – this request contains the time allocated for the session and also the name of the computer for which the session is allocated.

shutdown command – This command essentially shuts down the workstation

Because of the way our communication protocol works, we need to put code into the client application that is capable of handling simultaneous communication. This means that we need to divert client communication away from the main VCL thread. As we’ve already established in the previous articles, the main VCL thread is not thread safe. We therefore need to create a separate thread for client server communication.

The code that we are going to use for this exercise will be exactly the same as that of the server. The only difference will be that we will create an extra thread to continually read any communication from the server. We will call this thread the ReadingThread. It has the following definition:


TReadingThread = class(TThread)

protected

FConn: TIdTCPConnection;

procedure Execute; override;

public

constructor Create(AConn: TIdTCPConnection); reintroduce;

end;


And the following implementation:


constructor TReadingThread.Create(AConn: TIdTCPConnection);

begin

FConn := AConn;

inherited Create(False);

end;


procedure TReadingThread.Execute;


begin

while not Terminated and FConn.Connected do

begin

// refer to my earlier message for this code...

TLog.AddMsg(FConn.IOHandler.ReadLn);

end;

end;


Below is a screen shot of the client application:



The above is a screen shot of what the client looks like at the time of designing. The finished version will not have the buttons or the edit box. Instead, it will fill the entire screen and the ads will dominate most of the screen.


blog comments powered by Disqus
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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials