TsgcSTUNClient › 事件 › 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.Code 和 aError.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;