Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. String host = args[0].split("/")[0];
  2. String ipAddress = args[0].split("/")[1];
  3. // InetAddress address1 = InetAddress.getByAddress(host, ipAddress.getBytes());
  4. // System.out.printf("Looking up %s -> %s/%s%n", args[0], address1.getHostName(), address1.getHostAddress());
  5. // System.out.printf(String.format("Is reacheable for %s: %s%n", address1.getHostName(), address1.isReachable(1000)));
  6.  
  7.  
  8. InetAddress[] addresses = InetAddress.getAllByName(host);
  9. for (InetAddress address : addresses ) {
  10. System.out.printf("Looking up %s -> %s/%s%n", args[0], address.getHostName(), address.getHostAddress());
  11. System.out.printf(String.format("Is reacheable for %s: %s%n", address.getHostName(), address.isReachable(1000)));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement