TsgcUDPServerProperties › NotifyEvents

NotifyEvents Property

Controls how received-datagram, exception and lifecycle events are dispatched to the main thread.

Syntax

property NotifyEvents: TwsNotifyEvent read FNotifyEvents write SetNotifyEvents;

Default Value

Remarks

Determines the threading model used to fire OnUDPRead, OnUDPException, OnStartup, OnShutdown and OnBeforeWatchDog. The default value for the server is neNoSync, which fires events directly on the Indy reader thread and delivers the maximum throughput; event handlers must be thread-safe and must not touch VCL/FMX controls without their own synchronization. neAsynchronous queues events and delivers them to the main thread in the background, so UI controls can be updated safely without blocking the reader. neSynchronous uses Synchronize and waits for the handler to return, which is the slowest option but is convenient for simple UI-bound handlers. Choose the value that matches the throughput and thread-safety profile of the application.

Example

oServer.NotifyEvents := neAsynchronous;

Back to Properties