TsgcTURNServer › Events › OnSTUNException
Raised when an unhandled exception is caught while parsing or responding to a STUN/TURN message.
property OnSTUNException: TsgcSTUNExceptionEvent;
// TsgcSTUNExceptionEvent = procedure(Sender: TObject; E: Exception) of object
—
Fired when the server traps an exception while decoding a datagram, verifying MESSAGE-INTEGRITY, processing an ALLOCATE / REFRESH / CREATE-PERMISSION / CHANNEL-BIND method, relaying a Send-Indication or ChannelData packet, or writing a response back to the socket. The exception is absorbed by the listener so the server keeps running and the Allocation table stays consistent; use this event to surface the failure to logs or monitoring. Inspect E.ClassName and E.Message for details; do not re-raise E. The handler runs on the listener thread unless NotifyEvents redirects it, so avoid direct UI access without proper synchronization.
procedure TForm1.OnSTUNException(Sender: TObject; E: Exception);
begin
Memo1.Lines.Add('TURN error: ' + E.ClassName + ' - ' + E.Message);
end;