TsgcSTUNClient › Events › OnSTUNResponseSuccess
Fires when the STUN server returns a successful Binding Response with the client mapped address.
property OnSTUNResponseSuccess: TsgcSTUNResponseSuccessEvent;
// TsgcSTUNResponseSuccessEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message; const aBinding: TsgcSTUN_ResponseBinding) of object
—
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.
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;