Einzelnen Beitrag anzeigen

peterbelow

Registriert seit: 12. Jan 2019
Ort: Hessen
704 Beiträge
 
Delphi 12 Athens
 
#24

AW: limiting number of instances in Windows terminal server

  Alt 5. Jun 2019, 11:40
Hello,
I can read a little of German, but to write, not possible. So here is my question in English:
I have Delphi app which need to execute in Windows Terminal Server (nowdays RDS). We would like to be able to control how many instances user can run in their session. So for example:
- user 1 can run two instances of app 1
- user 2 can run 1 instance of app 1

We are able to fix this on Windows to have only one instance of application running but on TS is a bit problem for us. Anybody had similar problem?

Thank you.
This is the classical scenario for a licence server. You have a separate process (Windows or web service) running on a known platform. This process accesses a repository of licenses assigned to specific users. This can be a simple file. When your program is started it identifies the current user (Windows GetUsername API function) and then asks the licence server whether there is a free licence for that user available. If not it exits with a suitably ascerbic error message. If a licence is available it claims it from the server, usually giving the server a combination of computer name or ip address and process ID as a means to identify the claimer of the licence for the licence admin. When the application ends it returns the licence to the server.

The main problem in this scenario is how to deal with unexpected termination of the program holding the licence. In this case the licence is not properly returned to the server for later reuse. How to handle that depends on specifics of the environment. You can, for example, implement a mechanism that allows the server to check at intervals whether the processes having a licence in use are still running. Or you can require the program to regularly "renew" the claim they have on a licence, e.g. at 10 minute intervals. The licence is then reset to available if two of these intervals have passed without a renewal of the licence.
Peter Below
  Mit Zitat antworten Zitat