Channels provide a way for the TURN Client and Server to send application data using ChannelData messages, which have less overhead than Send and Data Indications.
Before use ChannelData messages to exchange data between peers, the TURN client must create a new channel, to do this, just call the method ChannelBind passing the Peer IP Address and Port as parameters.
If the TURN server can bind a new channel, the TURN client will receive a successful response OnTURNChannelBind event.
oTURN.SendIndication("80.147.23.157", 5000);
void OnTURNChannelBind(Component Sender, TsgcSocketConnection aSocket,
TsgcSTUN_Message aMessage, TsgcTURN_ResponseChannelBind aChannelBind)
{
DoLog("#Channel Bind: " + aChannelBind.Channel.ToString());
}
A channel binding lasts for 10 minutes unless refreshed. To refresh a channel just call ChannelBind method again.
When the TURN client receives a new ChannelMessage, the event OnTURNChannelData is called.
void OnTURNChannelData(Component Sender, TsgcSocketConnection aSocket,
TsgcTURNChannelData aChannelData)
{
DoLog("#Channel Data: [" + aChannelData.ChannelID.ToString() + "] " +
aChannelData.Data.ToString());
}