TsgcSTUNClient事件 › OnSTUNResponseError

OnSTUNResponseError 事件

当 STUN 服务器返回错误响应时触发;公开数字代码和可读原因。

语法

property OnSTUNResponseError: TsgcSTUNResponseErrorEvent;
// TsgcSTUNResponseErrorEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message; const aError: TsgcSTUN_ResponseError) of object

默认值

备注

当服务器以 STUN 错误响应(例如 401 Unauthorized、420 Unknown Attribute、438 Stale Nonce)回答绑定请求时调用。读取 aError.CodeaError.Reason 诊断故障,aMessage 提供原始响应。与身份验证相关的错误通常意味着在重试之前需要配置 STUNOptions.Authentication。

示例

procedure TForm1.oSTUNSTUNResponseError(Sender: TObject;
  const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message;
  const aError: TsgcSTUN_ResponseError);
begin
  DoLog('Error: ' + IntToStr(aError.Code) + ' ' + aError.Reason);
end;

返回事件