March 26, 2003

IPv6 in JRE 1.4.1 now works

With the final release of the 1.4.1 JRE/JDK (and perhaps with the help of the latest security download -- not sure), my IPv6 tests now all pass. Huzzah!

Here's my test program. If you have an IPv6 connection set up, they should all succeed.

import java.lang.*;
import java.io.*;
import java.net.*;

public class foo {
        public static void main(String[] args) {

                System.setProperty("java.net.preferIPv6Addresses", "true");

                DoATest("literal", "3ffe:1200:301b:0:2d0:b7ff:febe:e2a8");
                DoATest("A and AAAA host", "quack.kfu.com");
                DoATest("AAAA only host", "morpheus.kfu.com");

        }

        private static void DoATest(String testname, String host) {
                System.out.println("Starting test " + testname);
                try {
                        InetAddress ad = InetAddress.getByName(host);
                        System.out.println("Success: " + ad);
                        Socket s = new Socket(ad, 22);
                        System.out.println("Got connected.");
                        s.close();
                }
                catch(UnknownHostException e) {
                        System.out.println("Unknown host!");
                        return;
                }
                catch(IOException e) {
                        System.out.println("I/O Error!");
                        return;
                }
        }
}
Posted by nsayer at March 26, 2003 10:07 AM
Comments

I just tried this on my 10.2.5 box, and 1-2 work but 3 doesn't.
[maclap01:~/test] quentins% java -cp . foo
Starting test literal
Success: /3ffe:1200:301b:0:2d0:b7ff:febe:e2a8
Got connected.
Starting test A and AAAA host
Success: quack.kfu.com/3ffe:1200:301b:0:2d0:b7ff:febe:e2a8
Got connected.
Starting test AAAA only host
Unknown host!

As far as I know, I'm fully updated. (Software Update just shows the iMovie 3 update). It seems this just isn't fixed yet. Running "host morpheus.kfu.com" on the comand line correctly shows:
morpheus.kfu.com has address 3ffe:1200:301b:1:2d0:b7ff:fe3f:bdd0
I can't ping6 morpheus.kfu.com, however.
Java version:
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-39)
Java HotSpot(TM) Client VM (build 1.4.1_01-14, mixed mode)

Posted by: Quentin Smith at April 19, 2003 12:39 PM