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.
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.
精彩评论