Let’s talk a bit about the bandwidth usage and the related bandwidth management.
First, let’s try to describe what bandwidth is used by the tool.
Each time the client queries a web server, few bytes are sent are the request. In return, the server will send back some data to the client.
Calculate how many bandwidth is used is easy. We just have to add the side of the packets sent to the size of the packet received and we have the bandwidth used.
Now, this is on a perfect world. And again, the web is wide, and you will find, unfortunately, many other situation which are making it a bit more difficult to figure what bandwidth exactly has been used.
Let’s take few examples.
We don’t want to retrieve, yet, non-text content. Let’s imagine an url like http://domain.com/path_to_something. We don’t know yet what the content is. The only way to know that is to call it. So you send few bytes as the request header, and get a response. From the response, you get on the headers that it’s a binary file which is 600M size. So of course, you don’t want to retrieve it, and you send a cancellation. But now, have you start to receive some of the file content? May be. So you can count it, but between the time you sent the cancellation, and the time it really stopped, how many packets have you received from the servers? You don’t know. And you don’t have any easy way to know it.
Another example. The server you are calling is very slow. The time out is set to 20 seconds. After this period of time, you send a cancellation request, but just at the same time the server reply. Too late. You cancelled the request. So you will get some of the content again, plus headers that you will not take into consideration on your total.
So if you let the client run for few hours, at the end, with all the issues it might face on the web, there are high chances that some content was miss count.
I tried to build the client as accurate as possible, but the only way to get really accurate bandwidth usage is to track it on the TCP level, and not at high level like what I’m doing.
Since this information is not critical for the application, I have decided to keep it the way it is. I will do some small adjustments to take cancellation calls into consideration, but you can expect the displayed bandwidth usage to be a bit different than what your service provider or your tcp dump can display.
The instant download speed limitation is based on this value to. So far, I have not seen any difference bigger than 10%. So the limitation is still pretty accurate and useful.