局域网设备的目标C可达性 [英] Objective C reachability of LAN devices

查看:86
本文介绍了局域网设备的目标C可达性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Mac OS X上编写一个程序来管理LAN上的一些投影仪(使用IP地址),并且我试图弄清楚如何监视它们的连接状态.像是简单的ping一样,只是为了确保我可以联系到他们.

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.

我尝试使用NSURLRequest requestWithURL调用.它可以正常工作,但是如果有任何投影机处于脱机状态,则该程序会在相当长的时间内停止响应.我只是想获取状态并更改UI指示.

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.

推荐答案

尝试在NSURLRequest上设置timeoutInterval属性.否则,您将不得不在后台线程中运行ping连接,或者使用use NSURLConnect并检查传递给委托的异步回调.

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.

这篇关于局域网设备的目标C可达性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆