Clients periodically send data to server TIdFtpServer in passive mode. In one client machine, where network sometime is breaking I got message:
EIdReplyRFCError : File status okay; about to open data connection.
And next commands also throw exception like: EIdReplyRFCError : Requested action aborted: local error in processing.
When any EIdException apperar then clear socket like:
if Assigned(FFtp.IOHandler) then
begin
FFtp.IOHandler.InputBuffer.Clear;
FFtp.IOHandler.Close;
end;
FFtp.KillDataChannel;
But client cannot longer send data, still EIdReplyRDCError is throwing and I must restart Server FTP. After restart then client reconnect succesfully and can send data. In the server side, I don't logged any uncatched exceptions.
I tried also at the server side, kill clients which no send data over 20 minutes:
try
T := FFtpServ.Contexts.LockList;
for I := 0 to T.Count - 1 do
if TIdFtpServerContext(T[I]).Data <> nil then
begin
Cl := TFtpCl(TIdFtpServerContext(T[I]).Data);
Minutes := MinutesBetween(Cl.LastPing, Now);
if Minutes >= 20 then
begin
if(Assigned(TIdFtpServerContext(T[I]).Connection.IOHandler)) then
begin
TIdFtpServerContext(T[I]).Connection.IOHandler.InputBuffer.Clear;
TIdFtpServerContext(T[I]).Connection.IOHandler.Close;
end;
TIdFtpServerContext(T[I]).KillDataChannel;
end;
end;
finally
DM.FFtpServ.Contexts.UnLockList;
end;
But in this approach often I got AccessViolation exception.
Any idea to solve this problem?