DownloadFileAsync

  • Thread starter Thread starter Yehia A.Salam
  • Start date Start date
Y

Yehia A.Salam

Hello,

DownloadFileAsync blocks (or hangs) the application for 3 or 4 seconds if
there is no internet connection available, the expected behavior should be
to continue normally and raise the error in the DownloadFileCompleted event
in AsyncCompletedEventArgs, however this is not the case.

Thanks
Yehia
 
Hello, Yehia!

Does the url that is passed to DownloadFileAsync contain host name?

If that is so, try using IP address instead hostname, e.g.
http://10.2.2.1/file.text

You wrote on Wed, 15 Aug 2007 02:07:12 +0300:

YA> DownloadFileAsync blocks (or hangs) the application for 3 or 4 seconds
YA> if there is no internet connection available, the expected behavior
YA> should be to continue normally and raise the error in the
YA> DownloadFileCompleted event in AsyncCompletedEventArgs, however this is
YA> not the case.


With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com
 
yes it does, but how would this matter?


----- Original Message -----
From: "Vadym Stetsiak" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework
Sent: Wednesday, August 15, 2007 5:58 PM
Subject: Re: DownloadFileAsync
 
Hello, Yehia!

If there is a host name in the url, API tries to resolve that hostname into
an IP address (DNS) and only then perform connection.
If there is an IP address specified - API tries to connect to it without
resolution.

The lag of 3 or 4 seconds can be due to this resolution process.

You wrote on Thu, 16 Aug 2007 01:05:38 +0300:

YA> yes it does, but how would this matter?


YA> ----- Original Message -----
YA> From: "Vadym Stetsiak" <[email protected]>
YA> Newsgroups: microsoft.public.dotnet.framework
YA> Sent: Wednesday, August 15, 2007 5:58 PM
YA> Subject: Re: DownloadFileAsync

YA>>> DownloadFileAsync blocks (or hangs) the application for 3 or 4
YA>>> seconds if there is no internet connection available, the expected
YA>>> behavior should be to continue normally and raise the error in the
YA>>> DownloadFileCompleted event in AsyncCompletedEventArgs, however
YA>>> thisYA>>> not the case.


With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com
 
If there is a host name in the url, API tries to resolve that hostname [...]

According to MSDN, "This method does not block the calling thread".
Maybe the setup (including DNS resolution, web request creation etc)
should be non-blocking as well, or the documentation changed.
 
Back
Top