Download acceleration

I have Google'd my offt off and I can not find anything on this topic.

I am trying to create a download client using Java, and I figured out how to download files using Java, but I want to speed up the download speed. I know how this works (opening multiple connections to the download server), but how can I achieve this?

I am looking for either a detailed explanation of such an algorithm, or some code examples.

+3
source share
3 answers

This is only possible if the server side supports range requests. You can determine that by checking the use of the request HEADif the HTTP response header contains Accept-Ranges: bytes. If so, you can simply create multiple threads that load the file in parts using the header Range. URLConnectionand ExecutorServiceuseful in that.

Remember that you also consider the limitation of the number of threads and network bandwidth of your own computer.

Related questions:

+9
source

BalusC , , :

JDownLoader [Java]: http://svn.jdownloader.org/projects/show/jd

Free Download Manager [CPP]: http://freedownload.svn.sourceforge.net/viewvc/freedownload/

@BalusC Nice

+1

, Java-, (, Java?), ? , , . Java java.util.zip, .

( N) , N HTTP- . , , ..

Writing your own client and using multiple threads correctly is a whole job, so people just use the Apache HTTP client code. Its hard stone.

0
source

Source: https://habr.com/ru/post/1782039/


All Articles