?
Solved

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

Posted on 2006-07-20
3
Medium Priority
?
275 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 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

752 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