TsgcWebSocketFirewallMethods › SaveBansToFile

SaveBansToFile Method

Writes the current ban list, including expiry timestamps and escalation levels, to the specified file so it can be restored with LoadBansFromFile.

Syntax

procedure SaveBansToFile(const aFileName: string);

Parameters

NameTypeDescription
aFileNameconst stringDestination file path. Existing files are overwritten atomically.

Remarks

Call SaveBansToFile on a timer or during graceful shutdown so the ban state survives restarts and upgrades. Only active bans are written; expired records are skipped. The file format is a compact binary stream — match it to the corresponding LoadBansFromFile/LoadBansFromStream calls, do not edit it by hand.

Example

// persist bans during graceful shutdown
sgcWebSocketFirewall1.SaveBansToFile('bans.dat');

Back to Methods