Get local IP-Address without connecting to the internet

fe80:0:0:0:226:4aff:fe0d:592e is your ipv6 address ;-).

Check this using

if (current_addr instanceof Inet4Address)
  System.out.println(current_addr.getHostAddress());
else if (current_addr instanceof Inet6Address)
  System.out.println(current_addr.getHostAddress());

If you just care for IPv4, then just discard the IPv6 case. But beware, IPv6 is the future ^^.

P.S.: Check if some of your breaks should have been continues.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)