I need to ping a network with flash or actionscript

I created a tool to fix network problems in flash memory. The screen will show all the components on the screen. I have to ping each component once a minute. I finished the constructive part.

Please help me how can I ping a web address or IP address in flash memory.

I need some sample code .. Im using Flash CS3

+3
source share
2 answers

What do you mean, you have all the components on the screen, and you have to ping each component once a minute?

If ping you mean an application that checks the response time of a URL, then you can try playing with this code:

var ldr:URLLoader = new URLLoader();
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);

var url:String = "URL-TO-SITE";
var limit:int = 10;

var time_start:Number;
var time_stop:Number;
var times:int;

ping();

function ping():void
{
    trace("pinging", url);

    times = 0;
    doThePing();
}

function doThePing():void
{
    time_start = getTimer();
    ldr.load(new URLRequest(url));
}

function ldrStatus(evt:*):void
{
    if(evt.status == 200)
    {
        time_stop = getTimer();
        trace("got response in", time_stop - time_start, "ms");
    }

    times++;
    if(times < limit) doThePing();
}

, URLLoader URL- . status - 200, "ping". .

, ping .

, , upload-download-speedtester, - , Loader .

, .

EDIT:

, :

ldr.load(new URLRequest(url + "?rnd="+Math.random()));

, , . .

, , .

+3

, .

: ping, ICMP-, , Flash . , ping, UDP TCP, , Socket ( ).

+5

All Articles