TsgcUDPServer › Properties › WatchDog
Automatic listener-recovery monitor that restarts the server after unexpected shutdowns or missed heartbeats.
property WatchDog: TsgcUDPWatchDogServer_Options read FWatchDog write SetWatchDog;
—
When Enabled is True, an internal timer checks the server every Interval seconds and, if the listener is no longer Active, calls Start again automatically. Attempts caps the maximum number of restart attempts (0 = unlimited). The nested Monitor sub-property adds an active probe: when Monitor.Enabled is True the watchdog sends a secret datagram to the local listener and uses Monitor.TimeOut seconds as the round-trip limit before declaring the listener dead and issuing a ReStart, which catches situations where the socket is still open but the listener thread has stalled. Use OnBeforeWatchDog to veto a single restart cycle or to apply custom logic before the restart runs.
oServer.WatchDog.Enabled := True;
oServer.WatchDog.Interval := 10;
oServer.WatchDog.Attempts := 0;
oServer.WatchDog.Monitor.Enabled := True;
oServer.WatchDog.Monitor.TimeOut := 10;