TsgcTURNClientEvents › OnSTUNResponseError

OnSTUNResponseError Event

Fires when the server returns an error response (for example 401 Unauthorized or 437 Allocation Mismatch).

Syntax

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

Default Value

Remarks

Called when the server answers any STUN or TURN request with an error response. Read aError.Code and aError.Reason to diagnose the failure. Typical TURN error codes include 401 Unauthorized (credentials missing - RFC 5766 signs a retry automatically after the initial challenge), 437 Allocation Mismatch (transaction id reused or allocation not found), 438 Stale Nonce, 441 Wrong Credentials and 486 Allocation Quota Reached.

Example

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

Back to Events