TsgcWebSocketFirewallMethods › LoadBansFromFile

LoadBansFromFile Method

Restores the active ban list from a file previously written by SaveBansToFile, so bans survive process restarts.

Syntax

procedure LoadBansFromFile(const aFileName: string);

Parameters

NameTypeDescription
aFileNameconst stringPath to the ban file to load. Missing or empty files are ignored without raising an exception.

Remarks

Each record stores the IP, expiry timestamp and escalation level. Bans whose expiry has already passed are dropped during loading, so only still-valid bans are re-applied. The operation merges with the in-memory list; call ClearBans first if you need a clean replacement.

Example

// restore bans at start-up
sgcWebSocketFirewall1.LoadBansFromFile('bans.dat');

Back to Methods