I want to download a file from the Internet, and I think it should be a simple task. Having tried several different approaches, I found that each has its own drawback. Main problems:
- Application freezes before file upload
- The application freezes forever if the Internet connection is lost / the server is not responding.
(details:
How to get a file from the Internet via HTTP?
The connection does not disconnect when downloading a file from the Internet )
So finally, I used the suggestions I received from several people to use pro libraries such as Indy. However, Indy is not much better than the code snippets I tried (but it is much larger and difficult to maintain). When using Indy, the application does not freeze only for short periods of time, so it is still (somehow) applicable. However, the application cannot be disconnected until the download is completed (never if the Internet connections are damaged).
Other people reported the same issue: http://borland.newsgroups.archived.at/public.delphi.internet.winsock/200609/0609079112.html
https://forums.embarcadero.com/thread.jspa?threadID=25199&tstart=90
So, are there some hacks I had to do for TIDAntiFreeze to get it working?
In addition, the ConnectTimeout property is not recognized.
fIDHTTP := TIDHTTP.Create(NIL); fIDHTTP.ConnectTimeout:=5000;
Should I throw Indy and return to the original idea of ββloading a file into a separate stream and end the stream when it does not respond (at least, this is how I get rid of third-party libraries)? Will there be unforeseen side effects if I do this?
Usage: Delphi 7, Indy 10.1.5 10.5 (possible).
thanks
delphi indy10
Sahara
source share