posts - 218, comments - 222, trackbacks - 68

My Links

News




I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net) and born in Bangladesh.
I work for Ocean Informatics Pty Ltd as a Senior Developer - Analyst.
I am also co-founder and core developer of Pageflakes (acquired by LiveUniverse) www.pageflakes.com
and most recently created SmartCodeGenerator

My Articles
Flexible and Plugin based .Net Application..
Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker'
Write your own Code Generator or Template Engine in .NET
Smart Code Generator .NET: Usage Overview
Smart Code Generator .NET: Architectural Overview
Smart Code Generator .NET: using with NAnt and Cassini

Archives

Free Programming Language Training

Testing Bandwith Speed

Its not as hard as it sounds anyone can do this by throwing some javascript. Most of the speed test sites that are available, downloads a predefined file (a jpg or something with known size) and then uses javascript to find the time elapsed and then calculate the result.

In one of the popular site I saw something like this:

<html>
<script language="JavaScript">
function RightNow()
{
time = new Date();
return time.getTime();
}

function CalculateSpeed(timeStart)
{
timeEnd = RightNow();
timeElapsed = (timeEnd - timeStart)/1000 - 0.15;
kbytes = 1024/timeElapsed;
bits = kbytes * 1024 * 8;
document.forms[0].bps.value = bits;
//document.forms[0].submit();
}
</script>

<BODY >
<div>Bandwidth test in progress, please wait...<br><br></div>

<script language="JavaScript">
<!--
timeStart = RightNow();
//-->
</script>

<IMG SRC="http://something.com/images/1024.1.jpg?

a=10.54561000+1168998701" WIDTH="30" HEIGHT="30"

ONLOAD="CalculateSpeed(timeStart);" style="z-index: 1">

<FORM action="" method="post">
bits:<input type="text" name="bps" value="">
</FORM>
</BODY>
</html>

Note: There should be a mechanism to make sure the URL of the dowloadable image is dynamically generated and is different each time to avoid caching.

Print | posted on Wednesday, January 17, 2007 1:24 AM |

Feedback

Gravatar

# re: Testing Bandwith Speed

thanks...
11/20/2008 11:09 PM | murat karagöz

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 2 and type the answer here:

Powered by: