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.

TsgcICEClient

Implements the RFC 8445 ICE state machine — candidate gathering, prioritisation, pair generation, connectivity checks (BindingRequest with USE-CANDIDATE), nomination and consent freshness.

Component class

TsgcICEClient

Protocol

ICE (RFC 8445)

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Professional / Enterprise

Configure servers, gather, exchange, check

Configure STUN/TURN ICE servers, call GatherCandidates, exchange the candidate list with the peer (out of band), then StartChecks to nominate a working pair.

uses
  sgcP2P;

var
  ICE: TsgcICEClient;
begin
  ICE := TsgcICEClient.Create(nil);
  ICE.IceServers.Add('stun:stun.l.google.com:19302');
  ICE.IceServers.Add('turn:turn.example.com', 'alice', 'secret');

  ICE.OnICELocalCandidate := procedure(Sender: TObject;
    const aCandidate: string)
  begin
    SignalToPeer(aCandidate); // out-of-band SDP / WebSocket
  end;

  ICE.OnICEConnectionStateChanged := procedure(Sender: TObject;
    const aState: TsgcICEConnectionState)
  begin
    Memo1.Lines.Add('ICE: ' + GetEnumName(TypeInfo(TsgcICEConnectionState), Ord(aState)));
  end;

  ICE.GatherCandidates;
end;
// uses: sgcP2P
TsgcICEClient *ICE = new TsgcICEClient(this);
ICE->IceServers->Add("stun:stun.l.google.com:19302");
ICE->GatherCandidates();

What's inside

A reusable ICE engine that drops below TsgcRTCPeerConnection — or runs on its own for non-WebRTC P2P.

Candidate gathering

Enumerates host candidates from every local interface, server-reflexive candidates from each STUN server, relayed candidates from each TURN server — all in parallel.

Pair generation & prioritisation

Computes the candidate-pair priorities per RFC 8445 §6.1.2 and orders the check list. Frozen pairs unfreeze as their foundation makes progress.

Connectivity checks

Sends STUN BindingRequests with PRIORITY, ICE-CONTROLLING / ICE-CONTROLLED, USE-CANDIDATE attributes per the standard. Triggered checks fire on inbound stimulus.

Nomination

When a pair succeeds and the controlling agent flags USE-CANDIDATE, the component fires OnICEConnectionStateChanged with iceConnected, then iceCompleted on the final selected pair.

Implements RFC 7675 consent-freshness probes — periodic STUN BindingRequests on the nominated pair, with OnICEConnectionStateChanged(iceFailed) when consent is lost.

Signalling-agnostic

The component does not assume a specific signalling channel — you marshal local candidates over your WebSocket / SIP / HTTP signalling, and feed remote candidates back in.

Specifications & references

Authoritative sources for the protocol this component implements.

Documentation & Demos

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.
Demo Project — Demos\35.P2P\04.ICE Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Run ICE in Delphi?

Download the free trial and add full ICE candidate gathering and connectivity checks to your Delphi applications.