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:
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;
        $ip = $remote;
    return $ip;
$user_ip = getUserIP();
echo $user_ip; // Output IP address [Ex:]

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


• Livecode programming until the cat hits the fan •
View this message in context: 
Sent from the Revolution - User mailing list archive at Nabble.com.

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to