TsgcWebSocketServer › Properties › LastError
Read-only string with the description of the most recent error raised by the server.
property LastError: string read FLastError;
'' (empty string)
Whenever the component reports a failure through OnError or OnException, the error text is also stored in LastError, so the reason of the last failure (for example, a listener that could not be started because the port is already in use) can be inspected afterwards without handling those events. An empty string means no error has been recorded. The same property is available on the client components.
oServer := TsgcWebSocketServer.Create(nil);
oServer.Port := 80;
oServer.Active := true;
if not oServer.Active then
ShowMessage('Server failed to start: ' + oServer.LastError);