Test this bandwidth tester Please.. need feedback.
Hi,
I am testing a method of obtaining an aproximation of a site visitors bandwidth (or at least the speed they are loading my files at).
The following link is where I am testing. http://www.ozwide.net.au/~mpelic/shi...bandWidth.html
So far I seem to have had success. With a file size of only 11Kb the return data matches within a usable margin my connection speed.
Please have a go at it and post back your results (letting me know your bandwidth) as I would like a more complete picture of the accuracy or inaccuracy of the script I am using.
Thanks in advance. I will post the script if anyone is interested.
I got 50kbps.
Pretty close to what I shoulda got.
I have cable but live in australia. I assume you live in the US so thats probably the speed I woulda achieved for such a small file without my bandwidth reaching peak speed.
good work. that code might be very helpful --
edit: my bad. your aussie too :P
oh well. i still believe my peak speed argument. being it a bigger file it woulda given my comp a chance to get a better speed.
"Good lord, you're wasting thousands of dollars worth of Interferon!"
"... and you're Interferon with our good time!"
Your the first to reply. Thanks heaps.
I am in Aus. too. but on a dial up connection.
I had considered a larger file but I really wanted to see how accurate it could be with a small file. This way by testing on a small
file loaded with loadMovie() at the opening of the site I can then load content suitable for the users download speed. Or at least prompt them that they may wish to make that choice.
This makes it more possible to deliver a site heavy on animation/sound or a lighter version. I hate developing sites based solely around the lowest common denominator when there is so much to offer those who can handle it.
Fantastic!!!!!
That is a heap of output and much appretiated. I have attached the .fla file. I commented it a bit so you get some idea of whats what.
It is just two frames the first collecting the data with the use of setInterval() and the function lc(). The setInterval() is set really fast and I think that Flash most probably can't really deliver this speed (but it will try).
The second frame just calculates the collected data and puts it into the text fields.
The script is not optimized in any way and I know it could be improved on so any ideas are welcome. I used getTimer() to establish the time lapsed there may be a better method .. but I don't know what.
I use FlashMX(not 2004) on Windows PC. So I have also included the script below for anyone who may be developing on a different platform.
Frame 1:
Code:
stop();
//get the date time to append to URL to allow multiple tests without
//clearing the browser cache
myDate= new Date();
Y=myDate.getFullYear();
M=myDate.getMonth();
D=myDate.getDate();
mill=myDate.getMilliseconds();
//variables for holding time lapsed
//Time At Load Initiation
TALI=undefined;
//Time At First Data recieved
TAFD=undefined;
//Time At Fully Loaded
TAFL=undefined;
//flag variable for getting initial byte read
flag=0;
//create the holder clip
this.createEmptyMovieClip("h",0);
//initiate the .swf load
h.loadMovie("globalAssets/swfs/FirstHalfLogo.swf?nocache="+D+M+Y+mill);
//get time at load initiation
TALI=getTimer();
//set interval to do byte check
li=setInterval(lc,1);
function lc(){
l=h.getBytesLoaded();
t=h.getBytesTotal();
if((l>0 || t>0) && flag==0){flag=1;TAFD=getTimer();}
if(l>=t && l>0){
TAFL=getTimer();
clearInterval(li);
nextFrame();
}
}
Frame 2:
Code:
stop();
//file size
Fs=h.getBytesTotal();
//time at first data recieved
Fd=(TAFD-TALI);
//time at full load
Fl=(TAFL-TALI);
//load time in milliseconds
Ltms=((TAFL-TALI)-(TAFD-TALI));
//load time in seconds
Lts=(((TAFL-TALI)-(TAFD-TALI))/1000);
//bytes loaded per second
Bps=(Fs/Lts);
//dynamic text fields to display data
fileSize="File size = "+ Fs + " bytes";
initiated="Load initiated at 0 milliseconds";
firstData="First data recieved at " + Fd + " milliseconds";
fullyLoaded="Fully loaded at " + Fl + " milliseconds";
loadTime="Calculated load time = " + Ltms + " milliseconds or " + Lts + " seconds";
speed="Calculated download speed for this file= " + Math.ceil(Bps) + " bps";