Delphi ICE Client
Run the full ICE algorithm in Delphi/C++Builder — gather host, server-reflexive and relay candidates, perform STUN connectivity checks, nominate the best pair per RFC 8445.
Run the full ICE algorithm in Delphi/C++Builder — gather host, server-reflexive and relay candidates, perform STUN connectivity checks, nominate the best pair per RFC 8445.
Implements the RFC 8445 ICE state machine — candidate gathering, prioritisation, pair generation, connectivity checks (BindingRequest with USE-CANDIDATE), nomination and consent freshness.
TsgcICEClient
Windows, macOS, Linux, iOS, Android
Enterprise
Configure STUN/TURN ICE servers, call GatherCandidates, exchange the candidate list with the peer (out of band), then ProcessCandidates to run the checks and nominate a working pair.
uses
sgcP2P, sgcP2P_ICE_Classes;
// TFormICE holds FClient: TsgcICEClient and FLog: TStringList
procedure TFormICE.Gather;
begin
FClient := TsgcICEClient.Create(nil);
FClient.ICEServers.AddURL('stun:stun.l.google.com:19302');
FClient.ICEServers.AddURL('turn:turn.example.com', 'alice', 'secret');
FClient.OnICECandidate := OnICECandidate;
FClient.OnICECandidatePairNominated := OnICECandidatePairNominated;
FClient.GatherCandidates;
end;
procedure TFormICE.OnICECandidate(Sender: TObject;
const aCandidate: TsgcICE_Candidate);
begin
// AsString is the candidate line, ready for your signalling channel
SignalToPeer(aCandidate.AsString);
end;
// remote candidates arrive over your signalling channel
procedure TFormICE.AddRemoteCandidate(const aCandidate: string);
begin
FClient.AddRTCIceCandidate(aCandidate);
FClient.ProcessCandidates;
end;
procedure TFormICE.OnICECandidatePairNominated(Sender: TObject;
const aCandidatePair: TsgcICE_CandidatePair);
begin
FLog.Add('nominated: ' + aCandidatePair.Local.Address + ' -> ' +
aCandidatePair.Remote.Address);
end;
// includes: sgcP2P.hpp, sgcP2P_ICE_Classes.hpp
TsgcICEClient *Client = new TsgcICEClient(this);
Client->ICEServers->AddURL("stun:stun.l.google.com:19302");
Client->OnICECandidate = OnICECandidate;
Client->GatherCandidates();
A reusable ICE engine that drops below TsgcRTCPeerConnection — or runs on its own for non-WebRTC P2P.
Enumerates host candidates from every local interface, server-reflexive candidates from each STUN server, relayed candidates from each TURN server — all in parallel.
Computes the candidate-pair priorities per RFC 8445 §6.1.2 and orders the check list. Frozen pairs unfreeze as their foundation makes progress.
Sends STUN BindingRequests with PRIORITY, ICE-CONTROLLING / ICE-CONTROLLED, USE-CANDIDATE attributes per the standard. Triggered checks fire on inbound stimulus.
When a pair succeeds and the controlling agent flags USE-CANDIDATE, the component fires OnICECandidatePairNominated with the pair that won, and aCandidatePair.Local / Remote tell you which two addresses it picked.
Implements RFC 7675 consent-freshness probes: a Binding request on the nominated pair every ConsentInterval milliseconds, and OnICECandidatePairFailed with the reason Consent Freshness Timeout once ConsentTimeout passes with no answer.
The component assumes no particular signalling channel. You put aCandidate.AsString on your WebSocket, SIP or HTTP signalling, and feed what comes back to AddRTCIceCandidate followed by ProcessCandidates.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — TsgcICEClient Full property, method and event reference for this component. | Open | |
| Demo Project — Demos\35.P2P\04.ICE Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |