Here is my DownloadFile.ja va.
In UI of the project, I want to provide user to select download speed as Fast, Medium, Slow.How can I do this.I have also threadPool structure in my project in DownloadManager .java and it only takes 10 downloads to the pool.Is download speed related with it?Or how can I increase or decrease the speed of downloads?Any idea would be appreciated.
4 5325 Rabbit 12,516
Recognized Expert Moderator MVP
You might be able to throttle the speed, but there's not much you can do to increase the speed. That's dependent on their ISP and your ISP, distance from the server, and the level of service you each have.
@Rabbit How can I throttle the speed?
Nepomuk 3,112
Recognized Expert Specialist
I don't think there's a simple way to do that (at least I'm not aware of one), so you'll probably have to dig into the HTTP and maybe even TCP protocol. In theory, UDP may be used too, but the combination of HTTP and UDP is rare.
The thing to look out for is reducing the speed at which incoming packages are accepted; I believe there was even a value you could set in one of the packet headers to tell the server how quickly stuff should be sent. But even if that's not the case, you should somehow be able to throttle the speed at which your client accepts packets. Any reasonably modern server will quickly adjust.
In your while loop you read the downloaded file slice by slice where a slice size is defined by MAX_BUFFER_SIZE . So to throttle down:
- decrease the size of MAX_BUFFER_SIZE (but only if you want to slow down very small files)
- After reading a slice, place a sleep-command (line 80 in your code): Thread.sleep(10 0); This will sleep for 100ms before reading the next slice. ( You can increase this number 100 as needed to slow down even more)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dufffman |
last post by:
Hi,
We essentially have
(about 1000/sec) messages coming through a channel and I have to store
them in a UDB database. Will UDB be able to write it that fast? If
not what are a few strategies that I could implement to get over this
problem? I am relatively new to
databases, but have programming in java for a while.
|
by: Crouchie1998 |
last post by:
How do I work out the download speed in KB/Sec & how many hours/mins &
seconds left?
Thanks in advance for any help
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
2000 Interview questions of .NET , JAVA and SQL Server Interview
questions (worth downloading it)
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
|
by: HYRY |
last post by:
I want to join two mono wave file to a stereo wave file by only using
the default python module.
Here is my program, but it is much slower than the C version, so how
can I increase the speed?
I think the problem is at line #1, #2, #3.
import wave
import array
lfile = wave.open(lfilename)
rfile = wave.open(rfilename)
| |
by: chalani |
last post by:
Hi...
I was unable to find the implementation of process.java. What i need is the implementation of waitFor() method of process.java. but at every place what i find is the abstract class. could any of you send me an implementation code of the process.java
thnkx...
|
by: ajaymohank |
last post by:
Hello friends......... i am new to php. In my project i have to download a java page from a bat file, to the client side by passing values from the program. the problem is that i am getting the java page in my system, but when i try to run the program from another system, the page gets downloaded to my system, not on the system from which i called the program.. ie its running in the server,but not coming to the client side.... how can i solve...
|
by: Devang |
last post by:
Hello,
I am using php script to upload file.
some times if file size is too big(1GB) it takes too much time to
upload.
Can someone suggest me the way to increase upload speed.
thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |