Pour accéder aux connexions client actives, vous pouvez utiliser la propriété Connections pour itérer dans la liste et accéder à la classe de connexion client. La propriété Connections accède à une liste threadée ; verrouillez donc d'abord la liste et déverrouillez-la une fois terminé.
procedure DoClientIPAddresses;
var
i: Integer;
oList: TList;
oConnection: TsgcWSConnectionServer;
begin
oList := TsgcWebSocketHTTPServer1.LockList;
Try
for i := 0 to oList.Count - 1 do
begin
oConnection := TsgcWSConnectionServer(TIdContext(oList[i]).Data);
ShowMessage(oConnection.IP + ':' + IntToStr(oConnection.Port));
end;
Finally
TsgcWebSocketHTTPServer1.UnLockList;
End;
end;