Link to home
Start Free TrialLog in
Avatar of pjelias
pjelias

asked on

Help getting list of users still using application

Hi,

I have written an app using Delphi 6 and SQL Server Database, to be used under Windows 2000 environment.

There are times when the application will need to be closed to perform end of month processes. I have written code which will lock users out upon entering the application, if the application is "CLOSED FOR MAINTENANCE"

My question is How do I get a list of users who are still using the application if they are already in the APPLICATION, so that I can tell them to exit ?

I would like to do this via Delphi Code, and I will not have access to SQL SERVER Administration once the application is deployed.

Thanks
pje
Avatar of ginsonic
ginsonic
Flag of Romania image

listening
ASKER CERTIFIED SOLUTION
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JDN
JDN

Let you application create an 'in_use' file on the server for the user when he logs on to your program. This file must be deleted when the user logs off.
Check all the 'in_use' files currently on the server to determine the users logged on to your program.
I use this technique myself, very simple but it works fine.

JDN
or broadcast an udp packet when you're going to do the maintainance to notify the already running apps to shutdown :)
all of the comps on the local network will receive this packet
then the running apps would reply and you would know "who" is still using the app
and when a new app is run it could also broadcast some kind of a packet and only the 'server' would reply
so you automatically know the path to the database :)
and the server could reply with the status 'OK' or 'MAINTAINANCE' :)
then when finished it could again broadcast a packet to notify the running clients (if any) that they can proceed
I'd do it that way :)
Hi!
I did something like that under MySQL using a client_list table (Fields: ClientID,admin_cmd)

1. On log on each client signs up in the table
2. If I want to do administrative work on the db I set a value like "logout" in the field admin_cmd
3. Clients do "select admin_cmd from client_status" from time to time and respond to the returned value (e.g. "logout" results in deleteing the client entry in the table and *surprise* logging out)
4. Clients that do not respond in a predefined amount of time are assumed to be non active and are removed from the table
5. If the table is empty I can assume no one is logged in an do administrative work

Not really cool stuff, but it works.
Avatar of pjelias

ASKER

Easy way

thanks