开发者

Android - Maximum Timeout for InetAddress isReachable()

开发者 https://www.devze.com 2023-01-29 23:22 出处:网络
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

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 ther开发者_如何学Ce a better way to implement such function?

regards, Thomas


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消