TsgcWebSocketFirewall › Methods › LoadBansFromStream
Reads ban records from any TStream (memory, network, resource) in the same format produced by SaveBansToStream.
procedure LoadBansFromStream(aStream: TStream);
| Name | Type | Description |
|---|---|---|
aStream | TStream | Readable stream positioned at the start of a ban set previously produced by SaveBansToStream. |
Use the stream overload when ban persistence lives outside the filesystem — for example, a database BLOB, an encrypted archive, a cluster coordination service, or a configuration message received over the network. Expired records are discarded and the new entries are merged with any existing bans. Pair with ClearBans if you want a clean replacement instead of a merge.
var
oStream: TMemoryStream;
begin
oStream := TMemoryStream.Create;
try
oStream.LoadFromFile('bans.dat');
oStream.Position := 0;
sgcWebSocketFirewall1.LoadBansFromStream(oStream);
finally
oStream.Free;
end;
end;