Objective C reachability of LAN devices

主宰稳场 提交于 2019-12-25 03:15:16

问题


I need write a program on Mac OS X to manage some number of projectors on the LAN (using IP address), and I'm trying to figure out how to monitor their connection status. Something like a simple ping just to make sure I can reach them.

I've tried using the NSURLRequest requestWithURL call. It worked, but the program stops responding for quite a while if any of the projectors are offline. I'm just looking to get the status and change the UI indication.

Are there better ways to do this? Any help or point in the right direction would be great, thanx.


回答1:


Try setting the timeoutInterval property on the NSURLRequest. Otherwise you'll have to run the ping connection in a background thread, or else use use NSURLConnect and check the asynchronous callbacks delivered to the delegate.



来源:https://stackoverflow.com/questions/5374564/objective-c-reachability-of-lan-devices

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