TsgcUDPServer › Events › OnUDPException
Fires when the UDP listener thread catches an unhandled exception while receiving or sending datagrams.
property OnUDPException: TsgcUDPExceptionEvent;
// TsgcUDPExceptionEvent = procedure(Sender: TObject; Socket: TsgcUDPSocket; E: Exception) of object
—
Centralizes error reporting for the UDP server: the event is fired when an exception is raised while reading, writing or during the DTLS handshake with any peer. The E parameter is the original Exception instance and Socket identifies the endpoint on which the failure happened (PeerIP/PeerPort identify the remote peer when available). Common causes are OpenSSL load/handshake failures, ICMP Port Unreachable responses and operating-system socket errors. Log or display E.Message; do not raise the exception again, as the reader thread has already recovered and is ready to process the next datagram. The event is dispatched according to the NotifyEvents setting.
procedure TForm1.oServerUDPException(Sender: TObject; Socket: TsgcUDPSocket;
E: Exception);
begin
Memo1.Lines.Add('UDP server error: ' + E.Message);
end;