我需要使用 flash 或 actionscript ping 到网络
我用 Flash 创建了一个网络故障排除工具。该设计将在屏幕上显示所有组件。我必须每分钟对每个组件执行一次 ping 操作。我已经完成了设计部分。
请有人帮助我如何 ping 闪存中的网址或 IP。
我需要一个示例代码..我使用 Flash CS3
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,你不能。
更长:你将无法 ping,因为 ping 实际上是一个 ICMP 数据包,我不相信 Flash 可以发送这些数据包。如果您尝试 ping 的计算机上正在运行某些 UDP 或 TCP 服务,并且该计算机正在运行 套接字策略服务器,那么您就可以使用 套接字策略服务器。 html">Socket 类直接连接到该服务(其作用类似于 ping)。
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).
屏幕上显示了所有组件,并且必须每分钟 ping 一次每个组件,这是什么意思?
如果 ping 你指的是一个应用程序,它检查 url 的时间响应,那么你可以尝试使用以下代码:
这没什么特别的,
URLLoader
尝试加载 url,并监听到响应。如果status
为200
,则获得成功的“ping”。或者乒乓球。另一方面,您始终可以运行服务器端 ping 程序,并使用闪存对其进行控制。
如果您指的是一个应用程序,例如上传下载速度测试器,它也以类似的内容开头,但以 Loader 对象。
希望这有帮助。
编辑:
防止缓存问题,您可以使用:
现在,此页面可能不会返回站点的确切内容,但可能足以估计响应时间。带闪光灯。
总的来说,这可以清除缓存并每次加载网站以获得更好的结果。
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.