ICE starts gathering candidates, usually will obtain local IP Addresses, reflexive address using STUN protocol and relayed address using TURN protocol.
To start the gathering call the method GatherCandidates, this will start an internal timer where first will obtain the local IP addresses, then will connect to the STUN server to obtain the reflexive IP Address and finally will connect to TURN server to obtain the relayed IP Address.
Every time a new candidate is obtained, the event OnICECandidate will be called asynchronously, if there is any error while gathering the candidates, the event OnICECandidateError will be triggered.
oICE := TsgcICEClient.Create(nil);
oTURN := TsgcTURNClient.Create(nil);
oTURN.Host := 'www.esegece.com';
oTURN.Port := 3478;
oTURN.TURNOptions.Authentication.Credentials := stauLongTermCredential;
oTURN.TURNOptions.Authentication.Username := 'sgc';
oTURN.TURNOptions.Authentication.Password := 'secret';
oICE.GatherCandidates();
procedure OnICECandidate(Sender: TObject; const aCandidate: TsgcICE_Candidate);
begin
DoLog('[#Candidate] ' + aCandidate.AsString);
end;