Jump to content

bandwidthmeter script


tech123

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 --

[code]<?php

// $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);

?>

<script>
<!--
time          = new Date();
endtime      = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{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;

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

nextpage='<?php echo $nexturl; ?>';
document.location.href=nextpage
// -->
</script>[/code]

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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.