TsgcUDPServer › Properties › Bindings
Collection of local IP/port endpoints that the server listens on for incoming UDP datagrams.
property Bindings: TIdSocketHandles read GetBindings write SetBindings;
—
Each TIdSocketHandle entry describes a single listening endpoint (IP + Port + IPVersion). When Bindings is empty and the server is activated, a default binding is created from Host and Port. Add entries either at design time in the Object Inspector or at runtime with AddBinding to listen on multiple IPs or both IPv4 and IPv6 simultaneously; use RemoveBinding to stop listening on a specific endpoint without restarting the server. After the server is activated, an assigned TIdSocketHandle also exposes the effective local IP and port negotiated with the stack, which is useful when binding to port 0 to let the OS pick an ephemeral port.
with oServer.Bindings.Add do
begin
IP := '0.0.0.0';
Port := 5000;
end;
with oServer.Bindings.Add do
begin
IP := '::';
Port := 5000;
IPVersion := Id_IPv6;
end;
oServer.Active := True;