Jump to content


This topic is now archived and is closed to further replies.


bandwidthmeter script

Recommended Posts

Hi, I set up a speed test script on my server (specifcally, bandwidhthmeter - http://gambitdesign.com/bandwidthmeter/). I am trying to test the speed on my server which transfers data via satellite. Needless to say, the script times out repeatedly because the transfer time takes so long. Is there any way to prevent the script from timing out, specifically a few lines of code to add/change? I am sending a few different file size types.

This is the part of the script that does the actual grunt work of finding the speed --


// $data_file = "payload.bin";
// $fd = fopen ($data_file, "rb");
// if (isset($_GET['kbps'])) {
// $test_kbytes = ($_GET['kbps'] / 8) * 10;  //set the download to take 10 seconds
// if ($test_kbytes > 3000) {
// $test_kbytes = 3000;
// }
// } else {
$test_kbytes = $default_kbyte_test_size;
// }

$contents = fread ($fd, $test_kbytes * 1024);

echo "<!-- $contents -->";
fclose ($fd);


time          = new Date();
endtime      = time.getTime();
if (endtime == starttime)
{downloadtime = 0
{downloadtime = (endtime - starttime)/1000;

kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed    = kbytes_of_data/downloadtime;
kbps          = (Math.round((linespeed*8)*10*1.024))/10;

$nexturl = "results.php?kbps=' + kbps + '&downloadtime=' + downloadtime + '&KB=' + kbytes_of_data + '&recorded=1";

nextpage='<?php echo $nexturl; ?>';
// -->

I've commented out the test_kbyte part b/c I am not using an "initialmeter" to find an initial reading. Do I have to change something with the Date() function? or should I actually define the time and endtime with numeric values? Any help would be appreciated, thanks!

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.