Home > Back-end >  The problem of idhttp
The problem of idhttp

Time:09-27

For I:=0 to do int1-1
The begin
Stream:=TMemoryStream. Create;
IdHTTP1. Get (SRC, stream);
List1. ItemData. Bitmap. LoadFromStream (stream).
FreeAndNil (stream);
The end;

Now use idhttp get photo, picture very much, I want to ask, as in the above loop, is after idhttp get success to the data, continue to execute the following code? Will it Get out, go into the next cycle?
How to determine idhttp has successfully finished the get?

CodePudding user response:

IdHttp is blocked, Get content after the completion of the executed next,
If not out of the abnormal situation when the get executed, you can think is to perform a success, otherwise it will throw an exception, for this is likely to trigger the exception of calls, you should use exception handling,

CodePudding user response:

Exception handling method, more pictures, estimates will be very card, advice and delay processing,

CodePudding user response:

So, read in the image, large memory, easy to crash,
Read a image should be set up immediately after the save, and release the memory,

CodePudding user response:

Blocks, Get will continue after the completion,
Idhttp. OnWork OnWorkBegin OnWorkEnd can know already finished,
As mentioned, it is very easy to get wrong, throws an exception, plus a try

CodePudding user response:

reference 1st floor masm32v9 response:
IdHttp is blocked, Get content after the completion of the executed next,
If not out of the abnormal situation when the get executed, you can think is to perform a success, otherwise it will throw an exception, for this is likely to trigger the exception of calls, you should use exception handling,

Uh huh

CodePudding user response:

Idhttp is blocked, you if the code above pictures, the program will always no response until all images are downloaded over, so that users feel bad, and one thousand images cannot be successful download, stop running program will throw an error, I suggest use threads to asynchronous download images, each thread after download good timely release the memory, and one thousand downloads of unsuccessful fault-tolerant processing,

CodePudding user response:

Like you even add try except insurance, suggestion:
1, dynamic establishing idhttp
2, use thread
Otherwise, it is easy to appear the try can not capture the error,

CodePudding user response:

As the upstairs said, if it is multiple images, it is best to use threads, dynamically created in the thread Idhttp component download!
  • Related