TsgcWebSocketFirewall › Methods › SaveBansToFile
Writes the current ban list, including expiry timestamps and escalation levels, to the specified file so it can be restored with LoadBansFromFile.
procedure SaveBansToFile(const aFileName: string);
| Name | Type | Description |
|---|---|---|
aFileName | const string | Destination file path. Existing files are overwritten atomically. |
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.
// persist bans during graceful shutdown
sgcWebSocketFirewall1.SaveBansToFile('bans.dat');