TsgcUDPServerProperties › Port

Port Property

Local UDP port the server listens on when Bindings is empty.

Syntax

property Port: Integer read FPort write FPort;

Default Value

Remarks

Valid range is 1 to 65535, with 0 signalling that the operating system should pick an ephemeral port at bind time (the effective port can then be read from Bindings[0].Port once Active becomes True). When Bindings is populated, each TIdSocketHandle carries its own Port and this property is ignored for those entries. Ports below 1024 are privileged on Linux/macOS and require elevated rights. Port must be set before calling Start or assigning Active := True; to change it at runtime call Stop, update Port, and call Start again (or simply call ReStart).

Example

oServer.Port := 5000;
oServer.Active := True;

Back to Properties