How to fetch both IPv4 and IPv6 on dual stack OS

I have dual stack machine .

My problem is i am getting only IPv4 using

InetAddress address = InetAddress.getLocalHost();

and If i use Network Interface API then i get all the IP address in which includes my MAC addrres as well in the form of IP address.
why-do-i-get-multiple-global-ipv6-addresses-listed-in-ifconfig

Now is there any way i can get both IPv4 and IPv6 of my machine.


Source: java

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.