TsgcWebSocketClient属性 › LastError

LastError 属性

只读字符串,包含客户端最近一次引发的错误的描述。

语法

property LastError: string read FLastError;

默认值

''(空字符串)

备注

每当组件通过 OnErrorOnException 报告故障时,错误文本也会存储在 LastError 中,因此可以在之后读取失败操作的原因,而无需处理这些事件。在每次通过 Connect 发起新的连接尝试之前,该值会被自动清除。带有 out AError 参数的 Connect 重载会在连接失败时直接返回该值。空字符串表示尚未记录任何错误。

示例


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'wss://www.esegece.com:2053';
if not oClient.Connect(5000) then
  ShowMessage('Connection failed: ' + oClient.LastError);

返回属性