Geeks With Blogs

News Awarded Microsoft MVP C#.NET - 2007, 2008 and 2009


I am born in Bangladesh and currently live in Melbourne, Australia. I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net)and born in Bangladesh.
I am founder and Chief Executive Officer of
Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Co-founder and core developer of Pageflakes www.pageflakes.com.
Simplexhub, is on its mission to build a smart virtual community in Bangladesh and recently launched beta realestatebazaar.com.bd an ASP.NET MVC application written in C#.NET.


Some of 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
Shahed Khan blog

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.

Posted on Wednesday, January 17, 2007 1:24 AM | Back to top


Comments on this post: Testing Bandwith Speed

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Shahed Khan | Powered by: GeeksWithBlogs.net