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.
The Client for an Internet Access Control Application - Retrieving the Workstation Name (Page 4 of 4 )
The function below retrieves the computer or workstation name, which is then saved and sent to the server when connecting:
function TForm1.GetComputerName: string;
buffer: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
Size := MAX_COMPUTERNAME_LENGTH + 1;
Result := StrPas(buffer);
//*********end comp name function
The message synchronization functions have already been explained and should be easy to understand when looking through the code. The Dosychronize procedure is where the messages from the server are analyzed and processed. The server will send one of three commands, which this procedure needs to break down and execute:
//****** message synchronization functions
constructor TLog.Create(const AMsg: String);
FMsg := AMsg;
if cmd = 'activate' then begin
if cmd='shutdown' then
//initiate shut down
if not TimedShutDown(form1.GetComputerName, 'you have to shutdown', 30, true, true) then
if cmd='lockstation' then
if not form1.Visible then
class procedure TLog.AddMsg(const AMsg: String);
with Create(AMsg) do try
In the next article we will continue to explore some of the remaining procedures and functions.
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.