Hello All!
I'd like to download a file from my Delphi program in a separate thread dedicated to the download.
The problem is that the main program can be closed any time (thus the download thread can be terminated any time as well). So even if there is no connection or the server lags for precious seconds I need a way to terminate the download thread within a second or two.
What function do you guys recommend to use?
I've experimented with InterOpenURL/InternetReadFile but it doesn't have a time-out parameter. It does have an asynchronous version but I could't find any working Delphi examples and I'm not sure if the asynchronous version will protect me from hangs...
Using sockets have been recommended to me before, but TClientSocket doesn't seem to have a time-out function either.
I need to be fully-prepared so if the user has Internet-connection problems on his/her computer or the webserver keeps lagging my application doesn't hang before closing.
Please keep in mind when answering that I don't want to use neither any third party components nor Indy. Any example code is greatly appreciated.
Thank you!