I want to download a single file with Multi-Threads in C#.
e.g:
Thread1 start downloading from 1% to 40%.
Thread2 start downloading from 41% to 70%.
Thread3 start downloading from 71% to 100%
Please suggest me some code. Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about using HttpRequest class, with AddRange method called. This should a header with offset from which to start downloading.
You can then read from ´responseStream´ the data and merge it with the other threads once it is done.
However, as noticed by everybody else, this will only bring value if you have two adapters, both connected to internet, and you have some kind of bandwidth balancing between those adapter… Otherwise Windows wil likely divert everything to the same connection.