I am a student in my fourth year in university. My graduation project is a download manager which i intend to code with C#. when checked the MSDN documentation the project looked easy. But the problem is that my teacher wants me to incorporate multihoming to the project. He want the download manager to:
- split the file the user wants to download to multiple segments.
- for each segment the DM should create a connection and request that segment from the server.
- after all segments finish downloading the DM should combine the segments into one file.
- If multihoming exists each connection should go(or route) thru different ISP (as when multihoming is used, the computer is connected to more than one ISP thru more than one network adapter) as this process should accelerate the download of the file.
I can accomplish the first three steps but I couldn't find a solution to the fourth step so can anyone pleas help me or guide me thru the right way.
I am not an experienced networking and protocol programer I have only choose C# because it simplify the process of sending and requesting files.
I believe that your answer lies with the
ServicePoint.BindIPEndPointDelegateproperty, which you can set within yourHttpWebRequestinstance. Quoting MSDN:Basically,
BindIPEndPointDelegatelets you select the local endpoint to use for your connection. You can retrieve the list of all local IP addresses usingDns.GetHostAddresses(Dns.GetHostName()), and then pick one at random within the delegate. You do, however, need to be careful to match the address family: If the remote endpoint is IPv6, you need to select a local IPv6 address.I’m including some sample code below.
References:
Edit: I am not suggesting that you should actually pick local addresses at random for your project; the above code was just the simplest demonstration I could think of. If you’re establishing a number of concurrent connections and want to maximize load-balancing across all available adapters, then you should cycle through your local addresses; this would ensure that all adapters are handling an approximately equal number of connections each.