Datasnap - prevent users from running another instance

393 Views Asked by At

If one instance of Datasnap server is running, trying to open another one crashes this second instance. How can you prevent users from opening more than one instance of datasnap server?

On create of the server application :

Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TServerContainer1, ServerContainer1);
  Application.Run;

I tried putting LMDOneInstance on the Form1 but the server still keeps opening another instance (visible in the windows task manager). It does not crash the newly created instance but it just creates another process.

enter image description here

1

There are 1 best solutions below

2
On

Put a JvAppInstance on a data module, and it will handle the rest.