Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: InetAddress.isReachable() ? Date: Fri, 23 Oct 2020 18:10:09 -0500 Organization: A noiseless patient Spider Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 23 Oct 2020 23:10:11 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="8eb32e87f926618d8a7168e49e8ae1fc"; logging-data="1463"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19837RWuWkJKXgsVoVF8sqA" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:TevMwv7Yki//4441zIJZx7Px5pM= In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:39639 On 10/23/20 12:14 PM, Arne Vajhøj wrote: > On 10/23/2020 12:50 PM, Knute Johnson wrote: >> InetAddress.isReachable() only works if I run Java as root.  Any idea >> how to make it work with a regular user?  The docs say "A typical >> implementation will use ICMP ECHO REQUESTs if the privilege can be >> obtained".  I'm assuming that's why it won't work as a regular user. > > Is it worth it? Yes > The method can return false and the service you want to use > can be available (firewall blocking ICMP and Echo but not application > protocol). No firewalls there. > The method can return true and the service you want to use > can be unavailable (OS running but server application down). No service to connect to. Just want to see if there is a path to the router. > I think you would be better of connecting to the service > you want to use and handle errors there. Again no service to connect to. It's an internal network and I'm fielding calls all the time that 'we aren't getting updates to our data'. If I can ask is the little box green or red I'll know with some certainty the status of their network connection. I'm 1600 km from the site so I can't just pop over for a look see. I can't ask them to ping the router, that's a step too far. The network service at the remote sites is interrupted on a fairly regular basis. So yes I would really like to figure out how to make this work is it is possible.