Solved

What would be the most accurate method/procedure for accurately testing and displaying bandwidth?

Posted on 2006-07-20
3
273 Views
Last Modified: 2010-04-17
I realize that there are a lot of services online that can test bandwidth.  But, I'm curious what the best way to accurately program this would be for display on an ASP page...

0
Comment
Question by:boudog13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Expert Comment

by:bpmurray
ID: 17146625
The basic algorithm is to measure the time it takes to download and to upload a blob of data, usually a file. The larger the file, the more accurate the measurement since you can average the time more easily. For example if you download a 10MB file in 20 sec, that amounts to 500KB/s, or 4Mb/s.

However, the accuracy is dependant on distance between the client and server. If there are a lot of hops, latency can be an issue.

Display, on the other hand, is really trivial - you simply set the value into the display.
0
 

Author Comment

by:boudog13
ID: 17195388
Is it possible to count hops and factor this into the calculation?

Can this be done using a scripting language like JavaScript?
0
 
LVL 15

Accepted Solution

by:
bpmurray earned 250 total points
ID: 17195737
I don't think you can count the hops, but I would expect to use JavaScript to send the files. Copying a file locally would require that you download a file of known size e.g. through an XMLHttpRequest, or by setting the src attribute on an IMG tag. For example, you could do this:

<HTML><HEAD>
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<SCRIPT type="text/javascript">

var XHR = null;
var start = new Date();
var fileLocation = "http://whatever.com/foo.txt";   // Put your filename here ...
var fileSize = 132110;                                         // ... and the file's size

function TimeDownload() {
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        XHR = new XMLHttpRequest();
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
         try {
            XHR = new ActiveXObject("Msxml2.XMLHTTP");
         } catch(e) {
            try {
                XHR = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                // nothing
            }
        }
    }
    if (XHR) { // The XHR is created OK
        XHR.onreadystatechange = function() {
            if (XHR.readyState == 4 && XHR.status == 200) {
               var end = new Date();
               var elapsed = end - start;
               alert(fileSize + "bytes took: " + elapsed + " milliseconds");
            }
        }
        XHR.open("GET", fileLocation, true);
        XHR.send("");
    }
}
</SCRIPT>
</HEAD><BODY>
<IMG alt="This is where the file is copied" id="myImg" />
<BR />
<INPUT type="button" onclick="TimeDownload();" value="Time Downloads" />
</BODY> </HTML>

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question