473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

buggy asynchronous webClient

An authoritative source claims out-of-the-box asynchronous "WebClient' s
implementation is flawed" in .Net 3.0.

Was it fixed in .Net 3.5 or .Net 3.5 SP1?

Thank you.

Oct 14 '08 #1
6 2683
On Oct 14, 10:38*am, bill tie <bill...@discus sions.microsoft .com>
wrote:
An authoritative source claims out-of-the-box asynchronous "WebClient' s
implementation is flawed" in .Net 3.0.

Was it fixed in .Net 3.5 or .Net 3.5 SP1?
Without having any information about what the flaw was, how could we
tell? Can you give us more information about this "authoritat ive
source"?

Jon
Oct 14 '08 #2
I have no experience with the book, nor this method, but I found the quote
here:

http://www.albahari.com/threading/threading.pdf

page 49, under "Asynchrono us Events".

"Jon Skeet [C# MVP]" wrote:
On Oct 14, 10:38 am, bill tie <bill...@discus sions.microsoft .com>
wrote:
An authoritative source claims out-of-the-box asynchronous "WebClient' s
implementation is flawed" in .Net 3.0.

Was it fixed in .Net 3.5 or .Net 3.5 SP1?

Without having any information about what the flaw was, how could we
tell? Can you give us more information about this "authoritat ive
source"?

Jon
Oct 14 '08 #3
On Tue, 14 Oct 2008 04:24:01 -0700, Family Tree Mike
<Fa************ @discussions.mi crosoft.comwrot e:
I have no experience with the book, nor this method, but I found the
quote
here:

http://www.albahari.com/threading/threading.pdf

page 49, under "Asynchrono us Events".
Good find. Only the OP can say for sure if that's the reference they're
talking about, but it seems like a likely candidate. :)

As for the statement itself, I can't confirm or refute it for .NET 3.0,
not having that installed at the moment. In the latest version, looking
at it with Reflector, the only thing that pops out as a potential issue
that I can see is that it possible tries to resolve the URI before
returning. But I'd have to spend more time looking at it to be sure (I'm
just skimming through it).

If that's in fact the case, I suppose to some extent that could be
considered a bug. After all, you do expect the asynchronous call to
return immediately, but if it wastes time trying to look up the URI, that
could take awhile, especially if there's a problem with the network and
you wind up waiting on a timeout.

It's an interesting question. Of course, if that is indeed what
HttpWebClient is doing, it's easy enough to work around by making the call
to DownloadStringA sync(), etc. itself asynchronously (note that WebClient
itself simply relies on the concrete sub-class implementations , so each
implementation may or may not have the same flaw...I've only looked the
HttpWebClient version).

Pete
Oct 14 '08 #4
Good find. Only the OP can say for sure if that's the reference they're
talking about, but it seems like a likely candidate. :)
Indeed, that's what it is.

It's too bad heavyweights Jon Skeet and Peter Duniho are unable to pronounce
on a possible fix authoritatively . :-) I shall have to implement a
work-around.

Oct 14 '08 #5
On Oct 14, 2:33*pm, bill tie <bill...@discus sions.microsoft .com>
wrote:
Good find. *Only the OP can say for sure if that's the reference they're *
talking about, but it seems like a likely candidate. *:)

Indeed, that's what it is.

It's too bad heavyweights Jon Skeet and Peter Duniho are unable to pronounce
on a possible fix authoritatively . :-) I shall have to implement a
work-around.
Well now that we know what you're talking about, it's somewhat easier
to address your original question. In particular, I'll ping off a mail
to Joe Albahari to see if he's aware of any workarounds or
improvements. (Assuming I remember... kinda busy right now.)

Jon
Oct 14 '08 #6
On Tue, 14 Oct 2008 06:43:10 -0700, Jon Skeet [C# MVP] <sk***@pobox.co m>
wrote:
[...]
>It's too bad heavyweights Jon Skeet and Peter Duniho are unable to
pronounce
on a possible fix authoritatively . :-) I shall have to implement a
work-around.

Well now that we know what you're talking about, it's somewhat easier
to address your original question. In particular, I'll ping off a mail
to Joe Albahari to see if he's aware of any workarounds or
improvements. (Assuming I remember... kinda busy right now.)
At the very least, it'd be nice to know in what way specifically that and
other methods _aren't_ actually completely asynchronous. I didn't spend
enough time in Reflector to feel that I could say for sure my guess was
correct. He made the statement, so he should be able to explain precisely
what the issue is.

That said, whatever the specific problem might be, it seems like at least
some workarounds are pretty obvious. As I mentioned before, one could
simply execute the DownlownStringA sync() method asynchronously. For
example:

WebClient client = ...;

new Action(delegate { client.Download StringAsync(... );
}).BeginInvoke( );

Adding whatever error-handling and notification might be appropriate, of
course.

For that matter, if you want an event-based notification pattern, but
don't have to use the event in the WebClient itself, you could just call
DownloadString( ) synchronously, but from a BackgroundWorke r, handling the
BackgroundWorke r.RunWorkerComp leted event instead of
WebClient.Downl oadStringComple ted.

Pete
Oct 14 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
942
by: ptass | last post by:
Hi I've installed win2k3 sp1 on a machine where an openRead on any given file was previously working. After installation, I get a webException as follows... ..message "An exception occurred during a webclient request" .._Hresult = "-2146233079" .._COMPlusExceptionCode ="-532459699" Sorry I don't have the whole error, but this seems to be the only pertinent
2
5370
by: xzzy | last post by:
I have .net 1.1 c# . . . . . using System.Net only lists sockets what do I need to do to be able to do: using System.Net.WebClient;
0
1553
by: orekinbck | last post by:
Hi There This question is about calling an asynchronous web service from the UI thread. Unless I am making a fundamental error, it appears that the asynchronous web service call seems to spark off an Application.DoEvents() when system resources are low and the message loop has queued requests. Here are some snippets of code to describe the problem:
6
13305
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
6
22108
by: Giovanni | last post by:
Hi Guys, Really strange problem I am experiencing... I have setup a virtual directory with Read Only permissions on an ISA/IIS server (SBS 2003). In that virt. dir., I placed 1 file (setup.exe). I then use WebClient.DownloadFileAsync (.NET 2.0 Pro.) and all downloads well including progress bar indicator, bytes received, etc... Here is the problem: When I replace the file (setup.exe), with a different, larger file, it still...
1
6293
by: vin.dor | last post by:
Dear All, I am using WebClient in my Visual Studio .Net 2003 project to download an image from the Internet. The following is my function: C# Code: public static bool downloadFile(string URL, ref string fileName) { bool result = true;
1
6497
by: Mad Scientist Jr | last post by:
For some reason I can't get a WebClient to access an outside URL from behind our firewall. The code works when it runs outside the firewall. I turned on windows authentication in the web.config <authentication mode="Windows" /> and set up IIS to not allow anonymous access. My browser is set up to auto detect the proxy server, so IE/Firefox can access outside pages, so I added code to auto-detect the proxy server.
1
12507
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object System.Net.WebClient; $WebClient.Encoding = ::Default; $WebClient.Proxy = ::DefaultWebProxy; $WebClient.Proxy.Credentials = ::DefaultCredentials;
2
10177
by: MichaelSchoeler | last post by:
Hi, I'm having problems with the WebClient class regarding UTF-8 encoded data. When I access a specific webservice directly I can see the data arrives in corretly formatted UTF-8. But when I try to pull data from the same webservice url through the WebClient class I get partly garbled UTF-8 data in return. Only some UTF-8 chars (double byte pairs) seems to be corrupted. // Does not work WebClient wc = new WebClient(); string...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.