There is a long story here, but I would prefer to simply put the question
out.

If you wanted to sell "seats" to your program, or limit the number of
simultaneous users, what would be your approach?

The program runs on a server, all users at different PCs have a shortcut
to the application on the server. Delphi 5, windows LAN.

Easy for the program to insert a session record at login, remove it at
logout.

Clearly this will fail if the program exits (crashes) without removing the
session record.

Another approach might involve some polling after login: query how many
instances are running at this very moment, refuse login if all seats
taken. In this case the details are over my head: exactly what port, how
to poll, supporting inter-process communication etc. I fear implementing
this may  introduce more problems than I solve.

Finally, as I write this, it occurs to me I can start a timer, and update
"last activity" in the session record every X minutes. Then, at login,
remove all records where last activity is more than X minutes ago, before
attempting to take a seat. I could toss that in probably without too much
fear of introducing more bugs, but it would leave a window of X minutes
where the problem exists.

Just fishing for thoughts.
Any ideas or links appreciated.
Thank you.



Reply via email to