how to Ping

i want to check internet speed to google, then how to get return value of ping time?
i can’t figure out the syntax so i tried :

function  Update(){

but debug always return -1, please give me help of sample script…

The correct usage of 'Ping' is asynchronous- what you're trying to do here is start a fresh Ping every frame, without waiting for it to return anything!

Instead, use it like this:

function Start()

function PingGoogle()
    var googPing : Ping = new Ping("");
    // keep in mind that 'Ping' only accepts IP addresses, it doesn't 
    // do DNS lookup. This address may not work for your location-
    // Google owns many servers the world over.