Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Estimated download time" - how is this done? 2

Status
Not open for further replies.

techguru69

IS-IT--Management
Jan 14, 2003
129
US
Hello all,
Does anyone know of any scripts that can be added to a page or run against a set of files to produce the now-often-seen "estimated download time" stats on a file download page? I know you can calculate it manually, but is there a way to have it done when the user goes to the page, or have the server calculate it ahead of time on a manual basis?

TIA
 
 
Oh, and some web design applications calculate it for you, including Dreamweaver and FrontPage. In Dreamweaver MX it's at the bottom of the page, and the calculation includes any associated graphics and objects required to download the page.
 
Thanks folks!!

Nothing that will do it automatically - like a script that calculates it when the page loads for the user?? Just wishful thinking.

 
How is it an easy script to create? I've done a fair bit of searching and haven't found the TCP/IP overhead, routing delays, and average dropped packet percentages required to perform an even remotely-accurate calculation of same. Do you know where I can get this info?
 
Genimuse,

There is no reason to know that info, it wouldn't help at all. As estimated download time is built on optimal speeds, you cannot possibly account for different scenarios as any 2 requests will be different.

I will make up a sample script, give me 5 minutes.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Ok, I've put up a simple example. I've only set it up to calculate the seconds, it wouldn't take much time to convert that to minutes/hours though.


I've based this all on the best speeds that the modems are capable of. It would be easy enough to alter it to add some time to allow for network conditions or even calculate the transfer speed of the user when the page loads, then work it out from that.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
I absolutely completely disagree with you. Knowing that the average overhead is, say, 15% would make your number actually meaningful, especially when you're talking about times over a couple of minutes. If the user is to download a 3mb file and you say that it's going to take 2 hours but it's likely to take 2.5, you're doing a real disservice when your estimates don't take that into account.

Of course it would help.
 
Genimuse,

So, what you are saying is that the user who is on a perfect connection and will take 2 hours to download that file would be better served seeing the download time displayed as 2.5 hours?

Just take a second to think about this, there is no way for you to tell how good a users connection actually is or how long a download will actually take without making them download that file first. You could test their connection at the time they call the page their actual connection when they download the file is likely to vary from that data. Thats why we call it an estimate.

Just for the record, if you had read my other post:

I've based this all on the best speeds that the modems are capable of. It would be easy enough to alter it to add some time to allow for network conditions or even calculate the transfer speed of the user when the page loads, then work it out from that.


Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Genimuse,

Also, out of curiosity.

If my script is so meaningless, why did you post the links above to websites?

Check the calculated times, only one of them varies from the time that I calculated with my script.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Really, I'm not saying your script is meaningless: please don't be offended. My words in my previous post should have been "more meaningful," not "meaningful".

And yes, those scripts don't include it, which is also unfortunate. I provided them for the same reason you provided yours -- they're better than nothing.

I'm just trying to figure out how to provide a more accurate number, and was responding to your response to me, where you said "there is no reason to know that info, it wouldn't help at all," something that I still completely disagree with. Knowing the average overhead would certainly help, since even with a perfect modem connection the speeds provided in the scripts I linked to and that you provided don't take into account the TCP/IP overhead which is present even in a perfect connection.

Again, there's no need to take offense. We can disagree about the importance of the overhead without either one of us being wrong. Please accept my apologies if you felt I was somehow insulting you.
 
Hi mate,

Don't worry about offending me, I'm thick skinned.

The point I was trying to make was even if you displayed an average overhead included in the amount, you are still only providing an estimate that could be totally wrong, there is no way to actually tell how long it will take.

I could visit the page on a terrible dial-up connection from a country on the other side of the world, you could be on an excellent dial-up connection on the same network as the server. Both times would be totally different.

Either way, I said it was an easy script to create, I was meaning the actual coding, not the background research required.

To add an overhead of 15% to the script I created would require a few extra lines of code. It is still a very simple script to create.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Thanks for the help guys, but Gullie, I cannot get to the links for the sample scripts you mentioned above. It throws a 404 error.
Let me know if they are still available.
 
Like I said, we just see it differently. I understand what you're saying about varying download conditions but argue that while that's true, adding in the average overhead would make all of the estimates more accurate. It was in missing that knowledge that made it a non-simple script in my opinion -- it's easy to code, but difficult to make reasonably accurate.
 
Wullie-
Yes, please - post the script or email it to techguru69@myrealbox.com. I can probably convert it to vbscript/asp since primalscript can do those conversions.

Thanks. BTW, sorry I got the name wrong on the last post!
 
Hi mate,

Code:
<!--- Set File details --->
<cfset filename = &quot;#url.file#.exe&quot;>
<cfset filepath = &quot;/path/to/dir&quot;>


<!--- Locate file --->
<cfdirectory action=&quot;LIST&quot; directory=&quot;#filepath#&quot; name=&quot;getFile&quot; filter=&quot;#filename#&quot;> 

<!--- Convert to KB --->
<cfset kb = getFile.size / 1024>

<!--- Convert to MB --->
<cfset mb = kb / 1024>

<cfoutput>
<span style=&quot;font-weight:bold;&quot;>#filename#</span> is #Trim(NumberFormat(kb,'____'))# KB (#Trim(NumberFormat(mb,'____._'))# MB)<br><br>
</cfoutput>

<!--- Convert filesize to Bits --->
<cfset speed = getFile.size * 8>

<cfset k28 = speed / 28000>
<cfset k33 = speed / 33000>
<cfset k56 = speed / 56000>
<cfset cable = speed / 512000>
<cfset t1 = speed / 1500000>


<cfoutput>

<p>The time to download <span style=&quot;font-weight:bold;&quot;>#filename#</span> is estimated at the following:</p>
<table width=&quot;300&quot;>
<tr>
<td>28K Modem</td>
<td>#Trim(NumberFormat(k28,'____'))# Seconds</td>
</tr>
<tr>
<td>33K Modem</td>
<td>#Trim(NumberFormat(k33,'____'))# Seconds</td>
</tr>
<tr>
<td>56K Modem</td>
<td>#Trim(NumberFormat(k56,'____'))# Seconds</td>
</tr>
<tr>
<td>Cable Modem</td>
<td>#Trim(NumberFormat(cable,'____'))# Seconds</td>
</tr>
<tr>
<td>T1</td>
<td>#Trim(NumberFormat(t1,'____'))# Seconds</td>
</tr>
</table>

</cfoutput>

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top