0

There is a simple code on Java 8 which just check if the host is reachable

InetAddress inetAddress = InetAddress.getByAddress(ipBytes);
return inetAddress.isReachable(timeOutMS) ? "UP" : "DOWN";

There are two different ip addresses (lets say 1.1.1.1 and 2.2.2.2) which both are reachable from the Internet (e.g. https://ping.eu/ping/)

When I run this code on virtual hosting - both addresses are reachable when I ping them or run the code as jar.

But with AWS EC2 there is a trouble: I run AWS EC2 instance and checked ping 1.1.1.1 and 2.2.2.2 - both pinged well. But when I run the jar the code above shows that address 1.1.1.1 is reachable but 2.2.2.2 is NOT reachable.

What could be the problem ?

  • Possibly firewalls, possibly routing problems, possibly 2.2.2.2 or its ISP has a block list. There is insufficient information to say what the problem is. But it is most likely NOT a programming problem, which makes your question off-topic. – Stephen C Dec 03 '22 at 09:25
  • ISP is not the case as I pinged it from EC2 successfully but from the code it is unreachable. – Сергій Катрюк Feb 18 '23 at 15:44

0 Answers0