Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39641

Re: InetAddress.isReachable() ?

From Knute Johnson <nospam@rabbitbrush.frazmtn.com>
Newsgroups comp.lang.java.programmer
Subject Re: InetAddress.isReachable() ?
Date 2020-10-23 19:38 -0500
Organization A noiseless patient Spider
Message-ID <rmvt2a$nt2$1@dont-email.me> (permalink)
References <rmv1lf$pmq$1@dont-email.me> <rmv31v$vvl$1@gioia.aioe.org> <rmvnsi$1dn$1@dont-email.me> <rmvsjs$1h20$1@gioia.aioe.org>

Show all headers | View raw


On 10/23/2020 19:30, Arne Vajhøj wrote:
> On 10/23/2020 7:10 PM, Knute Johnson wrote:
>> 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
> 
> OK.
> 
>>> 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.
> 
> I cannot believe there are any ways to get around the privilege issue.
> 
> If there were then it would be a bug that would be fixed.
> 
> That leaves you with the awful hack of running the external
> ping command and read output.
> 
> Arne
> 

That's what I was afraid of Arne.  Oh well, I didn't have anything else 
to do this week :-).

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

InetAddress.isReachable() ? Knute Johnson <knute2020@585ranch.com> - 2020-10-23 11:50 -0500
  Re: InetAddress.isReachable() ? Arne Vajhøj <arne@vajhoej.dk> - 2020-10-23 13:14 -0400
    Re: InetAddress.isReachable() ? Knute Johnson <knute2020@585ranch.com> - 2020-10-23 18:10 -0500
      Re: InetAddress.isReachable() ? Arne Vajhøj <arne@vajhoej.dk> - 2020-10-23 20:30 -0400
        Re: InetAddress.isReachable() ? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2020-10-23 19:38 -0500
          Re: InetAddress.isReachable() ? Martin Gregorie <martin@mydomain.invalid> - 2020-10-24 11:45 +0000
            Re: InetAddress.isReachable() ? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2020-10-29 15:23 -0500
              Re: InetAddress.isReachable() ? Martin Gregorie <martin@mydomain.invalid> - 2020-10-29 21:36 +0000
              Re: InetAddress.isReachable() ? Arne Vajhøj <arne@vajhoej.dk> - 2020-10-29 21:47 -0400
                Re: InetAddress.isReachable() ? Knute Johnson <knute2020@585ranch.com> - 2020-11-01 10:30 -0600

csiph-web