TsgcICEClientEvents › OnICEReceiveBindingRequest

OnICEReceiveBindingRequest Event

Fires for each STUN binding request received from the peer during connectivity checks; set Accept to allow the probe.

Syntax

property OnICEReceiveBindingRequest: TsgcICEReceiveBindingRequestEvent;
// TsgcICEReceiveBindingRequestEvent = procedure(Sender: TObject; const aBinding: TsgcICE_Binding; const aMessage: TsgcSTUN_Message; var Accept: Boolean) of object

Default Value

Remarks

Fires when the ICE agent receives a STUN binding request from the remote peer during the connectivity-check phase (RFC 8445 section 7.3). The aBinding record identifies the local candidate that received the probe and the remote transport address, while aMessage exposes the full STUN frame (USERNAME, PRIORITY, ICE-CONTROLLING/CONTROLLED, USE-CANDIDATE, MESSAGE-INTEGRITY, FINGERPRINT).

The Accept parameter defaults to True; set it to False to silently drop the request (for example to enforce an ACL or to simulate packet loss during testing). When accepted, the agent replies with a binding response and records the pair as valid, which may lead to OnICECandidatePairNominated.

Example

procedure TForm1.oICEICEReceiveBindingRequest(Sender: TObject;
  const aBinding: TsgcICE_Binding; const aMessage: TsgcSTUN_Message;
  var Accept: Boolean);
begin
  DoLog('Binding request from ' + aBinding.RemoteIP + ':' +
        IntToStr(aBinding.RemotePort));
  Accept := True;
end;

Back to Events