Mobile Check Bandwidth Function

axwald axwald at gmail.com
Mon Jul 3 03:44:28 EDT 2017


Hi.

Peter Bogdanoff via use-livecode wrote
> Can anyone share their "test bandwidth" library?

Found it difficult & time consuming to test the actual bandwidth, so I'm
testing the latency now. Bad latency usually relates to bad bandwidth ;-)

On my server I have a php script:
-------------------------------------
<?PHP
function getUserIP()  // 'myip.php' -- service script; don't change!
{
    $client  = @$_SERVER['HTTP_CLIENT_IP'];
    $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    $remote  = $_SERVER['REMOTE_ADDR'];

    if(filter_var($client, FILTER_VALIDATE_IP))
    {
        $ip = $client;
    }
    elseif(filter_var($forward, FILTER_VALIDATE_IP))
    {
        $ip = $forward;
    }
    else
    {
        $ip = $remote;
    }
    return $ip;
}
$user_ip = getUserIP();
echo $user_ip; // Output IP address [Ex: 177.87.193.134]
?>
-------------------------------------

And in LC I use this function:
-------------------------------------
function INTest full
   put "http://myServer.net/tools/myip.php" into myIPURL
   if full then
      put the millisecs into t1
      put url myIPURL into myIP
      put the millisecs - t1 into t2
      return myIP & CR & t2
   else
      return url myIPURL
   end if
end INTest
-------------------------------------

Calling INTest() gives empty if we have no IN, else the actual public IP as
seen from the server (often useful anyways). Calling INTest(true)
additionally gives the latency on line 2.

Since this is small and not intrusive at all I can call it quite often to
monitor IN quality even on mobile.

Have fun!

axwald



-----
• Livecode programming until the cat hits the fan •
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Mobile-Check-Bandwidth-Function-tp4716503p4716511.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list