TsgcUDPServerProperties › Active

Active Property

Starts or stops the UDP listener; read to query whether the server is currently bound and accepting datagrams.

Syntax

property Active: Boolean read GetActive write SetActive;

Default Value

Remarks

Setting Active to True binds every configured socket handle from Bindings (or creates one from Host and Port if Bindings is empty), initializes DTLS when enabled, fires OnStartup and begins the reader thread that delivers OnUDPRead and OnUDPException. Setting it to False closes the listening sockets, clears the cached DTLS session and fires OnShutdown; the transition is synchronous and runs on the calling thread, so use Start and Stop to perform the same change from a worker thread when the UI must not block. When the WatchDog is enabled, an unexpected disconnection will automatically reopen the listener without requiring a manual Active assignment.

Example

oServer := TsgcUDPServer.Create(nil);
oServer.Port := 5000;
oServer.Active := True;

Back to Properties