TsgcTURNClient › Methods › SendChannelData
Sends a datagram to a peer using a bound channel, producing a smaller ChannelData message.
procedure SendChannelData(const aChannelID: Word; const aData: string);
| Name | Type | Description |
|---|---|---|
aChannelID | const Word | Channel number previously assigned by a successful ChannelBind (range 0x4000-0x7FFF). |
aData | const string | Text payload to relay; converted to UTF-8 bytes before being framed as ChannelData. |
Sends a ChannelData message (RFC 5766 section 11.5). The 4-byte ChannelData header (2 bytes channel + 2 bytes length) is much smaller than the 36+ byte SEND Indication header, which makes channels the preferred option for high-rate media such as RTP or DTLS.
oTURN.ChannelBind('203.0.113.25', 49200);
// Once OnTURNChannelBind fires with the assigned channel id:
oTURN.SendChannelData($4000, 'hello');
procedure SendChannelData(const aChannelID: Word; const aData: TBytes);
| Name | Type | Description |
|---|---|---|
aChannelID | const Word | Channel number previously assigned by a successful ChannelBind. |
aData | const TBytes | Raw byte payload to relay; used verbatim inside the ChannelData frame. |
Binary-payload variant of ChannelData. Use this overload for media packets or any content where a text encoding round-trip would corrupt the data. The payload is padded to a 4-byte boundary on the wire as required by RFC 5766.
var
vRTP: TBytes;
begin
// vRTP holds a serialized RTP packet.
oTURN.SendChannelData($4000, vRTP);
end;