TsgcUDPCLientEvents › OnUDPException

OnUDPException Event

Fires when the UDP reader thread catches an unhandled exception.

Syntax

property OnUDPException: TsgcUDPExceptionEvent;
// TsgcUDPExceptionEvent = procedure(Sender: TObject; Socket: TsgcUDPSocket; E: Exception) of object

Default Value

Remarks

Centralizes error reporting for the UDP client: it is fired when an exception is raised while sending, receiving or during the DTLS handshake. The E parameter is the original Exception instance and Socket identifies the endpoint on which the failure happened. Common causes are DNS resolution errors, 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. The event is dispatched according to the NotifyEvents setting.

Example

procedure TForm1.oClientUDPException(Sender: TObject; Socket: TsgcUDPSocket;
  E: Exception);
begin
  Memo1.Lines.Add('UDP error: ' + E.Message);
end;

Back to Events