How do I ping from Flex - AIR?

霸气de小男生 提交于 2020-01-01 10:53:17

问题


I'm bored cause my development server is down and I'm running the command prompt to ping the server indefinitely so that I'll see when they stop timing out and know that I can work again. In the meantime I wanted to make an Air app that will do this for me, so I can have it chirp or alarm or do something when it starts to be able to connect to the server.

So I need to start with having AIR do the ping, does anyone know how to do this? I can't find any help on it. I can't use the HTTPService because whatever it is that is broken (think it's the VPN), our dev web site is still up.

Thanks


回答1:


Otherwise you can use the NativeProcess class of the AIR 2.0 beta, and use the ping command of your operating system.

You can find informations on how to use it here.




回答2:


According to the docs, SocketMonitor, descending from ServiceMonitor will check basic availability, but not a true ping. If you want to truly "ping" the server, you would need to use a socket an implement the protocol, This link to the Wikipedia article might help.




回答3:


The AIR SDK offers some classes (URLMonitor, SocketMonitor) to handle this:

http://livedocs.adobe.com/flex/3/html/help.html?content=network_connectivity_1.html



来源:https://stackoverflow.com/questions/2185635/how-do-i-ping-from-flex-air

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!