Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to control total of users?
Message
 
 
To
11/11/2022 15:28:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01685303
Message ID:
01685305
Views:
54
>Hello all,
>
>My application is available as a remote desktop application.
>
>I want to control the number of users that can use it simultaneously. For example let's say that I paid for 3 licenses. Let's also say company1 can connect using two licenses and company2 can only use 1 license.
>
>So in the end I don't want company2 to be able to use two licenses.
>
>I have old code that was created by Craig Berntson that was supposed to do that.
>
>What would you suggest? My development computer uses Windows 11 and the public cloud computer runs Windows Server 2016.
>
>Thanks in advance.

I would use a method of semaphore files. For example, if a company has 3 licenses, I would create and lock files (using fcreate()):
user001.log
user002.log
User003.log
And leave these files locked for the entire application use. When a user leaves the application, unlock and delete this user's file (e.g. user002.log). Even if they do not unlock the file, it will be unlocked by the OS (I think after a brief time).
So, when a new user enters the application, the code should check if all file can be locked again. If none, they cannot use the application. If any file (e.g. user001.log) can be locked, a new user will lock this file and continue on.
I think you get the idea.

HTH
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform