STUN Protocol

STUN (Session Traversal Utilities for NAT) support in sgcWebSockets. Discover public IP addresses and NAT types for peer-to-peer connectivity.

Capabilities

  • Discover public-facing IP address and port
  • Detect NAT type (full cone, restricted, symmetric)
  • RFC 5389 compliant implementation
  • UDP and TCP transport support
  • Essential for WebRTC and P2P connectivity

Delphi Example

uses
  sgcSTUN_Client;

var
  STUN: TsgcSTUNClient;
begin
  STUN := TsgcSTUNClient.Create(nil);
  STUN.Host := 'stun.l.google.com';
  STUN.Port := 19302;
  STUN.OnSTUNBinding := HandleBinding;
  STUN.Bind;
end;

Ready to Use STUN?

Download the free trial and start building in minutes.