![]() |
URLDownloadToFile Timeout setzen
Moin,
ich suche schon seit 2 Tagen nach einer Möglichkeit, einen Timeout für URLDownloadToFile anzugeben. Ist das wirklich nicht vorgesehen (das kann ich mir fast nicht vorstellen)? Alle Vorschläge, die ich ergooglen konnte, bezogen sich auf eine "Frickellösung" mit Timern o.ä. im OnProgress des Callbacks. Hat vielleicht jemand noch eine andere Idee? |
Re: URLDownloadToFile Timeout setzen
leg es in einen Tread und kill denn Thread falls nach x Sekunden die Datei noch nicht erzeugt wurde.
|
Re: URLDownloadToFile Timeout setzen
Das wäre eine Möglichkeit, Danke.
|
Re: URLDownloadToFile Timeout setzen
Zitat:
|
Re: URLDownloadToFile Timeout setzen
du könntest aber auch auf andere APIs umsteigen, wo soetwas vorgesehn ist
z.B.
Delphi-Quellcode:
hSession := InternetOpen('User', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
InternetSetOption(hSession, INTERNET_OPTION_CONNECT_TIMEOUT, ... InternetSetOption(hSession, INTERNET_OPTION_SEND_TIMEOUT, ... InternetSetOption(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, ... InternetSetOption(hSession, INTERNET_OPTION_DATA_SEND_TIMEOUT, ... InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, ... InternetSetOption(hSession, INTERNET_OPTION_DISCONNECTED_TIMEOUT, ... hURL := InternetOpenURL(hSession, PChar(URL), nil, 0, 0, 0); Try ... If not InternetReadFile(hURL, @Buffer[1], BufferSize, BufferLength) Then ... Finally InternetCloseHandle(hURL); InternetCloseHandle(hSession); End; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz