If you’ve ever visited an Internet café, you've noticed that there is usually a timer on the screen that tells you how much time you have left to use the Internet. In this series of articles we will discuss both the underlying architecture of such an application as well as the code involved, culminating in creating an example application.
Building an Internet Access Control Application - The Server Application (Page 3 of 4 )
The server application is at the heart of the entire access control application. It is responsible for keeping a list of active client computers in real time and to enable staff members of an Internet café to allocate Internet sessions. Also, once a session has been started, the server application has to display the following session information:
Workstation name
Start time of the session
End time of the session
Time allocated
Charge
Status
I will explain later what all of these are. Because the server application will act as the control center of the whole setup, it will have additional commands to which it will expect the client to respond.
One of them is the shutdown command. This command sends the shutdown instruction that basically shuts down a workstation. This is necessary when a staff member cannot get to the workstation to either restart it or shut it down, in case there is a problem with it.
If for any reason a workstation develops a problem, the staff member will simply select the workstation name from the list on the server application and send the shutdown or restart commands to that workstation.
A second important command is lockstation. This command simply sets the screen block to active and disables the keyboard and mouse.
Finally, there is the activate command. This command unblocks a workstation and readies it for Internet access. It also sets up the timer form and starts the timer.
Another very important function of the server is to set the path to the advertisements. When you visit Internet cafes, the screen block on the client computer usually has some advertising on it. Now, when the client application is first started, it tries to learn where to find the advertisements by reading from an ini file. Below you will see the contents of my ini file:
[Path]
pathdir=c:intertimeradsWWWIMG_transparent.htm
In my setup you can clearly see the path is set to point to the ads directory. Now all clients will go to this path to get their HTML or htm page (assuming that the advertisements are stored as animated gifs or simple images in an HTML page). So when you change the actual advertisements, the server will tell the clients where to go to get them.
This application assumes that there is a network of computers with a server, on which the server application will run. This way the server application can store all advertisement information locally on the server and the clients can all go to a central point to collect this information.