I have an application where a remote client is connected to WSocket Server.
On program close I want to disconnect all clients before the server is freed.
The DisconnectAll routine throws an access violation exception.
In the DisconnectAll there is a loop to disconnect all clients and the loop counter is a property of the TCustomWSocketServer.
It is read by the function GetClientCount which in turn returns the FClientList.Count property.
Should work normally but the ClientCount does not change., in my case it stays at 1.
The first loop is ok, the second crashes.
In the Disconnect routine WClientClosed is called where the client is freed.
The comment there tells what should happen, but obviously it does not.
{ Calling Free will automatically remove client from list }
{ because we installed a notification handler. }
When I disconnect the clients one by one the client count exception is gone but in my FormClose routine I got another access violation exception.
This time at the line 'if operation = opRemove' below.
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TCustomSslWSocket.Notification(AComponent: TComponent; operation: TOperation);
begin
inherited Notification(AComponent, operation);
if operation = opRemove then begin
if AComponent = FSslContext then
FSslContext := nil;
end;
end;
Delphi 13 32Bit on W11, ICS 9.5 VCL only installed from Getit.
Does anybody have an idea to solve this ?