I want to upload a file from my Delphi program into a separate download thread.
The problem is that the main program can be closed at any time (thus, the download stream can also be interrupted at any time). Therefore, even if there is no connection or the server is lagging behind in precious seconds, I need a way to complete the download stream in a second or two.
What function do you recommend to use?
I experimented with InterOpenURL / InternetReadFile, but it does not have a timeout parameter. It has an asynchronous version, but I cannot find any working Delphi examples, and I'm not sure that the asynchronous version will protect me from freezes ...
Using sockets has been recommended to me before, but TClientSocket also does not have a timeout function.
I need to be fully prepared, so if a user has problems connecting to the Internet on his / her computer or the web server remains behind, my application does not freeze before closing.
Please note that I do not want to use either third-party components or Indy. Any sample code is much appreciated.
Thanks!
multithreading delphi download delphi-7 wininet
Steve
source share