Reputation: 21
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?
Upvotes: 2
Views: 664
Reputation: 596407
What you describe suggests the FTP communication has gotten out of sync. TIdFTP
is processing server responses in the wrong order. The best you can do is just have the client disconnect and re-connect. You do not have to do anything on the server side.
Upvotes: 0
Reputation: 21
After Contexts.UnLockList. I think in the client-pool thread exception is throwing.
How properly disconnect specified client at the server side?
Upvotes: 0