TsgcUDPServerEvents › OnBeforeWatchDog

OnBeforeWatchDog Event

Fires before each WatchDog cycle so the application can inspect state and optionally suppress the automatic restart.

Syntax

property OnBeforeWatchDog: TsgcUDPOnBeforeWatchDogEvent;
// TsgcUDPOnBeforeWatchDogEvent = procedure(Sender: TObject; var Handled: Boolean) of object

Default Value

Remarks

Fired at every WatchDog tick when WatchDog.Enabled is True, just before the component decides whether to call Start (to bring the listener back up) or DoWatchDogMonitor (to probe a still-Active listener). Setting Handled to True instructs the watchdog to skip this cycle entirely, which is useful for implementing custom health checks, exponential back-off, maintenance windows or for pausing reconnection attempts while the network is known to be down. Leaving Handled as False lets the default behaviour proceed. The event runs on the watchdog timer thread.

Example

procedure TForm1.oServerBeforeWatchDog(Sender: TObject; var Handled: Boolean);
begin
  // Skip watchdog restart during planned maintenance.
  Handled := MaintenanceMode;
end;

Back to Events