开发者

Indy is not working anymore after update

I had all kind of problems with Indy and following someone’s recommendations (at stackoverflow) I have updated to the latest version of Indy - at least this is what I intended to do.

Before starting the installation, I have manually deleted all files containing the "indy" word from my Delphi and from registry. Then I have followed the standard install procedure: http://www.indyproject.org/sockets/Docs/Indy10Installation.en.aspx

Now the piece of code below is not working anymore. The code just returns FALSE;

function Download(CONST aSourceURL: string; CONST aDestFileName: string; OUT aErrm: String): Boolean;
VAR
  Stream: TMemoryStream;
  IDAntiFreeze: TIDAntiFreeze;
  fIDHTTP : TIDHTTP;
begin
  fIDHTTP := TIDHTTP.Create(NIL);
//  fIDHTTP.ConnectTimeout:=5000;     <- not recognized
  fIDHTTP.ReadTimeout:= 1000;
  fIDHTTP.HandleRedirects :开发者_JAVA技巧= TRUE;
  fIDHTTP.AllowCookies := FALSE;
  fIDHTTP.Request.UserAgent := 'Mozilla/4.0';
  fIDHTTP.Request.Connection := 'Keep-Alive';
  fIDHTTP.Request.ProxyConnection := 'Keep-Alive';
  fIDHTTP.Request.CacheControl := 'no-cache';
  IDAntiFreeze := TIDAntiFreeze.Create(NIL);

  Stream := TMemoryStream.Create;
  TRY
    TRY
      fIDHTTP.Get(aSourceURL, Stream);
      {
      if FileExists(aDestFileName)
      then DeleteFile(PWideChar(aDestFileName)); }

      Stream.SaveToFile(aDestFileName);
      Result:= TRUE;
    EXCEPT
      On E: Exception do
        begin
          Result:= FALSE;
          aErrm := E.Message + ' (' + IntToStr(fIDHTTP.ResponseCode) + ')';
        end;
    END;
  FINALLY
    Stream.Free;
    IDAntiFreeze.Free;
    fIDHTTP.Free;
  END;
end; 

There is any way to see which version of Indy I have installed?

Edit: Also I get an "Unit idHTTP was compiled with a different version of IdException.IdException" message. Fixed.


You should first use the Delphi setup to uninstall the version of Indy that is installed with Delphi - then you can cleanup any remaining file. You should not start by cleaning folders and registry by hand. Then you can install another version. Be aware some releases are "breaking"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜