TsgcUDPCLientMethods › ClearDTLS

ClearDTLS Method

Discards the cached DTLS session state so the next datagram triggers a fresh DTLS handshake.

Syntax

procedure ClearDTLS;

Remarks

After the first encrypted datagram is sent, the client reuses the negotiated DTLS session keys for all subsequent traffic. Call ClearDTLS to force the client to forget those keys and perform a new handshake on the next WriteData call; this is required when the destination peer (Host/Port) has changed, when DTLSOptions have been modified, or when the session has expired on the remote side. The method has no effect when DTLS is disabled and is safe to call at any time.

Example

oClient.ClearDTLS;
oClient.Host := 'other-server.example.com';
oClient.WriteData('hello');

Back to Methods