I have created a network trouble shooting tool in flash. The design will have all the componenets on the screen. I have to ping to every component once in minute. I have finished the design part.
Please someone help me how do i ping a webaddress or IP in flash.
I need a sample code.. Im using Flash CS3
What do you mean by you have all the components on the screen and you have to ping every component once in a minute?
If by ping you mean an app, what checks the time-response of a url, then you can try to play with this code:
This is nothing special, the
URLLoader
tries to load the url, and listens to the response. If thestatus
is200
, then got a successful "ping". Or pong.On the other hand, you can always run a server-side ping program, and control that with flash.
If you mean an app, like an upload-download-speedtester, that also starts with something like this, but rather with the Loader object.
Hope this helps.
EDIT:
Preventing cache problems, you can use:
Now, this page might not give back the exact content of a site, but might be good enough to estimate the response time. With flash.
So overall, this could clear the cache and load the site everytime to give a better result.
In short, you can't.
In longer: you won't be able to ping, because a ping is actually an ICMP packet, and I don't believe Flash can send those. If there is some UDP or TCP service running on the machine you're trying to ping, though, AND the machine is running a socket policy server, then you would be able to use the Socket class to connect directly to that service (which could act like a ping).