TsgcSTUNClientEvents › OnSTUNResponseSuccess

OnSTUNResponseSuccess Event

Fires when the STUN server returns a successful Binding Response with the client mapped address.

Syntax

property OnSTUNResponseSuccess: TsgcSTUNResponseSuccessEvent;
// TsgcSTUNResponseSuccessEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message; const aBinding: TsgcSTUN_ResponseBinding) of object

Default Value

Remarks

Called when the server answers a Binding Request with a 2xx STUN response. aBinding.RemoteIP and aBinding.RemotePort contain the reflexive (NAT-mapped) address discovered by the server; aMessage gives access to the full response, including any extra attributes returned.

Example

procedure TForm1.oSTUNSTUNResponseSuccess(Sender: TObject;
  const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message;
  const aBinding: TsgcSTUN_ResponseBinding);
begin
  DoLog('Remote IP: ' + aBinding.RemoteIP +
        '. Remote Port: ' + IntToStr(aBinding.RemotePort));
end;

Back to Events