TsgcWebSocketServer › 属性 › LastError
只读字符串,包含服务器最近一次引发的错误的描述。
property LastError: string read FLastError;
''(空字符串)
每当组件通过 OnError 或 OnException 报告故障时,错误文本也会存储在 LastError 中,因此可以在之后检查最近一次失败的原因(例如,由于端口已被占用而无法启动的监听器),而无需处理这些事件。空字符串表示尚未记录任何错误。客户端组件上也提供相同的属性。
oServer := TsgcWebSocketServer.Create(nil);
oServer.Port := 80;
oServer.Active := true;
if not oServer.Active then
ShowMessage('Server failed to start: ' + oServer.LastError);