TsgcICEClientMethods › GatherCandidates

GatherCandidates Method

Starts ICE candidate gathering; each discovered candidate is reported through OnICECandidate.

Syntax

procedure GatherCandidates;

Remarks

Launches the ICE gathering phase described in RFC 8445 section 5.1. The client enumerates host candidates from every local network interface and, when ICEOptions.GatherCandidates.STUN is enabled, obtains server-reflexive candidates by probing the configured STUN/TURN server. If ICEOptions.GatherCandidates.TURN is enabled and a TURNClient is attached, an allocation request yields a relayed candidate.

Each candidate is reported asynchronously via the OnICECandidate event so it can be forwarded to the remote peer through your signalling channel (typical WebRTC flow). Errors during gathering surface in OnICECandidateError.

Example

oICE := TsgcICEClient.Create(nil);
oICE.TURNClient := oTURN;
oICE.OnICECandidate := OnICECandidateHandler;
oICE.GatherCandidates;

Back to Methods