TsgcWebSocketServerProperties › Bindings

Bindings Property

Collection of IP/Port pairs the server listens on; use it to bind several endpoints simultaneously.

Syntax

property Bindings: TIdSocketHandles read GetBindings write SetBindings;

Default Value

— (empty; server falls back to Port on all interfaces)

Remarks

Add one entry per IP/Port combination the server must listen on. Each entry exposes IP, Port and IPVersion; when the collection is empty the server binds to every interface on Port. Use Bindings to serve both an HTTP and an HTTPS endpoint on the same component, or to restrict the server to one physical interface. Call Bindings.Clear() after stopping the server if you plan to reassign the listening endpoints before restarting.

Example


oServer := TsgcWebSocketServer.Create(nil);
With oServer.Bindings.Add do
begin
  IP := '127.0.0.1';
  Port := 80;
end;
With oServer.Bindings.Add do
begin
  IP := '127.0.0.1';
  Port := 443;
end;
oServer.Active := true;

Back to Properties