title: Android and IPv6 in Java
body: <p>I am developing an Android application and I need to use IPv6 to connect to a server.</p>
  
  <p>IPv6 is enabled on the phone and I can see my local IPv6 address with <code>ip addr</code>. I can also successfully <code>ping6</code> my phone from the PC and viceversa.</p>
  
  <p>But hen I try to get local addresses on Android through the Java command <code>NetworkInterface.getNetworkInterfaces()</code> I only get IPv4 addresses.</p>
  
  <p>I also tryed to open a client socket but the line
  <code>Socket s = new Socket(MYSERVERIPV6ADDRESS, PORT);</code>
  always throws <code>java.net.SocketException: Invalid argument</code>.
  I am sure the address is correct because I tryed with the same code on my computer and works perfectly.</p>
  
  <p>It seems that IPv6 is supported by the operating system but not by the Java virtual machine. Is there a way to solve this problem?</p>