TsgcTURNClientEvents › OnTURNChannelBind

OnTURNChannelBind Event

Fires after a successful ChannelBind response; exposes the channel number assigned to the peer.

Syntax

property OnTURNChannelBind: TsgcTURNChannelBindEvent;
// TsgcTURNChannelBindEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message; const aChannelBind: TsgcTURN_ResponseChannelBind) of object

Default Value

Remarks

Fires when the TURN server confirms a ChannelBind request. Read aChannelBind.ChannelID (range 0x4000-0x7FFF) to obtain the channel number assigned to the peer; this is the value to pass to SendChannelData when relaying traffic to that peer with the compact 4-byte ChannelData framing. The binding also implicitly installs a peer permission and must be refreshed before 10 minutes elapse.

Example

procedure TForm1.oTURNTURNChannelBind(Sender: TObject;
  const aSocket: TsgcSocketConnection; const aMessage: TsgcSTUN_Message;
  const aChannelBind: TsgcTURN_ResponseChannelBind);
begin
  DoLog('Channel bound, id: ' + IntToStr(aChannelBind.ChannelID));
end;

Back to Events