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.
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?
The method can return false and the service you want to use
can be available (firewall blocking ICMP and Echo but not application protocol).
The method can return true and the service you want to use
can be unavailable (OS running but server application down).
I think you would be better of connecting to the service
you want to use and handle errors there.
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
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.
On 10/23/2020 19:30, Arne Vajhøj wrote:
On 10/23/2020 7:10 PM, Knute Johnson wrote:That's what I was afraid of Arne. Oh well, I didn't have anything else
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
to do this week :-).
On Fri, 23 Oct 2020 19:38:34 -0500, Knute Johnson wrote:
On 10/23/2020 19:30, Arne Vajhøj wrote:
On 10/23/2020 7:10 PM, Knute Johnson wrote:That's what I was afraid of Arne. Oh well, I didn't have anything else
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
to do this week :-).
Apologies if this is stuff you already know, but I tend to use
traceroute, wireshark and nmap to sort out network problems and this
sounds as if it might be some sort of network problem.
Could it be a physical problem, e.g. rodent or physical cable damage
causing an intermittent connection?
traceroute can show which switch or device is the last device accessible along the message route.
Wireshark can be used to show what is being transferred and what
responses are returned when a problem occurs.
nmap would seem less useful in this case, though at least it shows what
ports are open at the destination IP address, so can spot firewall
problems and dodgy interface cards.
Sorry to be slow responding Martin. It's been one of those weeks.
I'm not sure why Java has the privilege issue with
InetAddress.isReachable() but it does.
On 10/29/2020 4:23 PM, Knute Johnson wrote:
I'm not sure why Java has the privilege issue with
InetAddress.isReachable() but it does.
Someone thought that use of ICMP in Linux should
require privs.
The ping executable is rws while the java
executable is rwx.
Arne
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (0 / 16) |
Uptime: | 107:08:47 |
Calls: | 6,700 |
Files: | 12,232 |
Messages: | 5,348,345 |