|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
WebClient::DownloadFileAsync() ThrottlingI have a situation where I would like to manage how fast an http download occurs from a server (basically, the server risks crashing
itself if it goes full bore). I know there's no download rate paramter for the DownloadFile() methods in WebClient. I was wondering if some other class offers that capability. Or, failing that, is the DownloadProgressChanged event a blocking call? If it is, I could insert some logic to delay executing the event handler, thereby slowing down the data transfer rate. - Mark Thus wrote Mark,
> I have a situation where I would like to manage how fast an http Whether a .NET method call is blocking or not doesn't affect a remote server > download occurs from a server (basically, the server risks crashing > > itself if it goes full bore). > > I know there's no download rate paramter for the DownloadFile() > methods in WebClient. I was wondering if some other class offers > > that capability. Or, failing that, is the DownloadProgressChanged > event a blocking call? If it is, I could insert some logic to > > delay executing the event handler, thereby slowing down the data > transfer rate. sending data. What you would need to do is throttle the traffic at TCP level. But fixing this on the client side is a doomed approach anyway... -- Joerg Jooss news-re***@joergjooss.de Hi Mark,
Glad to see you. As for the WebClient class, when we use asynchronous downloading, the download work is done in a background thread pool thread, and the DownloadProgressChanged just work like a one way notification to inform us the status(the underlying download work continue no matter what we do in the event handler). Also, for the data transfering rate control, generally it is done at raw TCP/ IP protocol level through some specific component or APIs , it is beyond the ability of the .NET network components (Like webclient or httpwebrequest...). BTW, if the server-side application is also developed by you, you can consider controling the rate your server application flush data into the response stream. For example, in ASP.NET's page or handler code, we can manually use a loop to write out a file stream into page's response stream. Anyway, for standard networking transfer rate control, you may have a look at some general networking programming reference. Regards, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) You're welcome Mark,
Please feel free to post here when there is anything else we can help. Regards, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|||||||||||||||||||||||