07-15-2019, 09:00 AM
(07-15-2019, 08:53 AM)Alexandre Machado Wrote: It has been tested in all C++ Builder versions.My function in ServerController:
LockList() and UnLockList() don't exist anymore. I'm about to publish a new demo showing how to deal with this.
If you are using these functions how were you able to build your application?
procedure TIWServerController.KillDoubleSession(Username

var LSessions : TList;
LSession : TIWApplication;
i:Integer;
cAppID

begin
cAppID:='';
LSessions := GSessions.LockList;
try
for i := 0 to Pred(LSessions.Count) do
begin
LSession := LSessions[i];
LSession.Lock;
try
if (LSession.Data as TIWUserSession).WebUser.Username = Username then
begin
cAppID:= LSession.AppID;
break;
end;
finally
LSession.Unlock;
LSession := nil;
end;
end;
finally
GSessions.UnLockList(LSessions);
end;
if cAppID <>'' then
begin
GSessions.Terminate(cAppID);
end;
end;
How now by new?