Article

From:
To:
Hafedh TRIMECHE
Subject:
Re: TidHTTP and response timeout
Newsgroup:
embarcadero.public.delphi.internet.winsock

Re: TidHTTP and response timeout

> {quote:title=Hafedh TRIMECHE wrote:}{quote}
> > {quote:title=Terry Yapt wrote:}{quote}
> > Delphi 2010 Prof.
> > Indy 10.5.5
> > ========
> > 
> > Hello,
> > 
> > I have been looking for this in google and in the indyInDepth book, but I have not
> > found anything useful (or I could understand).
> > 
> > I have to get an image from a web server (http) and I am using a
> > function I found on some place.
> > 
> > Ok, in summary, I use this:
> > 
> > 
> > {code}    try
> >       idHttp.Get(URL, imgStream);
> >     finally
> >       idHttp.Free;
> >     end;
> > {code}
> > 
> > but if idHttp client has no answer at all, then there is no timeout or the
> > timeout parameter:
> >  {code} idHttp.ReadTimeout {code}
> > doesn't run as I am expected.
> > 
> > How can I set a real timeout to the idHttp client ?
> > 
> > Thanks.
> > 
> > PS: I have send the same question in Atozed Newsgroup.
> > 
> > Edited by: Terry Yapt on Oct 22, 2010 6:22 AM  ( Delphi and Indy versions added. )
> 
> Please try:
> idHTTP.IOHandler.ReadTimeout

Where could I put the idHTTP.IOHandler.ReadTimeOut inside this code ?

{code} function DownloadJPGToBitmap(const URL: string; ABitmap: TBitmap): Boolean; var   idHttp : TIdHTTP;   imgStream: TMemoryStream;   jpgImage : TJPEGImage; begin   result := false;   imgStream := TMemoryStream.Create;   try     idHttp := TIdHTTP.Create(nil);     idHttp.ConnectTimeout := 3000;     try       idHttp.Get(URL, imgStream);     finally       idHttp.Free;     end;     imgStream.Position := 0;     jpgImage := TJPEGImage.Create;     try       jpgImage.LoadFromStream(imgStream);       ABitmap.Assign(jpgImage);       result := True;     finally       jpgImage.Free;     end;   finally     imgStream.Free;   end; end; {code}
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sat, 18 May 2024 23:47:56 UTC
Copyright © 2009-2024
HREF Tools Corp.