Android - InetAddress isReachable() 的最大超时
我正在使用 InetAddress.getByName(params[0]).isReachable(300000) 来 确定我的 NAS 是否还活着。 通过测量上述方法前后的时间我发现 超时时间最长约为 3 分钟。 10秒,即使我 将超时设置为 600000(大约 10 分钟)。
我做错了什么吗?或者有没有更好的方法来实现这样的 功能?
问候, 托马斯
I'm using InetAddress.getByName(params[0]).isReachable(300000) to
determine if my NAS is alive.
By measuring the time before and after the above methode I found out
that the timeout has a maximum of about 3 min. 10 seconds, even if I
set the timeout to 600000 (about 10 minutes).
Am I doing something wrong? Or is there a better way to implement such
function?
regards,
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我改变了我的方法。现在我正在使用 Runtime.getRuntime().exec 对远程 IP 执行 ping 操作。这比 isReachable 更可靠。
I've changed my approach. Now I'm using Runtime.getRuntime().exec to execute a ping to the remote-ip. That's more reliable than isReachable.