TsgcWebSocketServer › Proprietà › LastError
Stringa di sola lettura con la descrizione dell'errore più recente generato dal server.
property LastError: string read FLastError;
'' (stringa vuota)
Ogni volta che il componente segnala un errore tramite OnError o OnException, il testo dell'errore viene memorizzato anche in LastError, quindi il motivo dell'ultimo errore (ad esempio, un listener che non è stato possibile avviare perché la porta è già in uso) può essere esaminato in seguito senza gestire tali eventi. Una stringa vuota significa che non è stato registrato alcun errore. La stessa proprietà è disponibile nei componenti client.
oServer := TsgcWebSocketServer.Create(nil);
oServer.Port := 80;
oServer.Active := true;
if not oServer.Active then
ShowMessage('Server failed to start: ' + oServer.LastError);