You don’t need StartPosition
, fileStream.Seek()
and Buffer = new byte[bytesLeft];
Also the lock()
shouldn’t be necessary (if it is you’ve got a lot more troubles).
So remove all that because the chances are you got some of it wrong.
And if it then still doesn’t work, edit the question and provide more information. There is quite a lot missing right now:
- could you verify with the debugger if the download loop is executed at all.
- how is the changeover to the 2nd range 52k – 104k performed
- how long is the resulting file in the end?
- does the file contain the first 52k bytes or the 2nd download?
- etc
All of that matters and we shouldn’t have to guess.
3
solved A problem with segmented file write