Einzelnen Beitrag anzeigen

Delphi.Narium

Registriert seit: 27. Nov 2017
2.431 Beiträge
 
Delphi 7 Professional
 
#3

AW: Indy FTP mit Threads Timeout

  Alt 23. Jan 2023, 12:32
Handelt es sich denn bei einem TimeOut um einen SocketError?

In der Unit IdExceptionCore sind noch etliche weitere Exceptions definiert, z. B. EIdReadTimeout, EIdConnectTimeout.

Ändert sich durch eine Erweiterung der Fehlerbehandlung etwas?
Delphi-Quellcode:
try
  Form2.Ftp1.Get('file1.txt',TPath.Combine(TPath.GetTempPath, 'file1.txt'),True,false);
  Form2.Ftp1.Get('file2.txt',TPath.Combine(TPath.GetTempPath, 'file2.txt'),True,false);
except
  on e: EIdSocketError do //<- hier würde ein Timeout auftauchen dachte ich
  begin
     Form2.Memo1.Lines.add(Format('%s EIdSocketError: %d %s', [DateTimetoStr(now),e.LastError,e.Message]);
  end;
  on e: EIdConnectTimeout do
  begin
     Form2.Memo1.Lines.add(Format('%s EIdConnectTimeout: %d %s', [DateTimetoStr(now),e.LastError,e.Message]);
  end;
  on e: EIdReadTimeout do
  begin
     Form2.Memo1.Lines.add(Format('%s EIdReadTimeout: %d %s', [DateTimetoStr(now),e.LastError,e.Message]);
  end;
  on e: EIdException do //<- hier würde eine beliebige INDY-Exception auftauchen, hoffe ich
  begin
     Form2.Memo1.Lines.add(Format('%s EIdException: %d %s', [DateTimetoStr(now),e.LastError,e.Message]);
  end;
  on e: Exception do //<- hier wird alles an Exceptions auftauchen, was bisher nicht abgefangen wurde.
  begin
     Form2.Memo1.Lines.add(Format('%s %s: %s', [DateTimetoStr(now),e.ClassName,e.Message]);
  end;
end;
  Mit Zitat antworten Zitat