Jump to content
xisto Community
Sign in to follow this  
turbopowerdmaxsteel

Power Failure Event Handling In Download Manager

Recommended Posts

Annoyed by the frequent power failures and voltage fluctuations, resulting in Bad Shutdowns, I made my own Download Manager in VB .NET. The download manager uses 4 simultaneous connections to download the file. The 4 parts are static and their range does not change throughout the operation. Before beginning the download, the size of the content is retrieved and a file of the same size, filled with the Hex value '00' is created. As the download begins, another file is created, which stores the current marker for each of the 4 connections, thus allowing the download process to be resumed. When resuming, the markers are shifted 10KB back each, to minimize the chances of data corruption due to power failures.

 

I have tried this process for files of around 10 MB size and tested by forcing bad shutdowns and it works (the file not getting corrupted). But, when I tried the same for a ~450 MB stuff, it got corrupted during download (which I only came to know, after the operation finished and tried running the file). I am sure it must have happened because of the power failures, which kept recurring. I even had Write Behind Caching disabled on the HDDs to make sure that the data was physically written. Inspite of all the safety measures, the file got corrupted. I want to resolve this problem for the future downloads, but I need to know what exactly happens during such an event (power failure, I mean). Here are some other details which might help :-

 

> File Opened in Binary Mode after the '00' filled file was created and closed thereby resolving the problem of having the size of the download file modified.

> Log File Maintained which contains all the locations of resume operations.

 

I would appreciate any suggestion in resolving the issue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.