Using IPv6 in real Java programs

IPv6 usage is now slowly starting, so I am currently repairing and updating all applications ready for IPv6

One of the applications is the java editor josm( http://josm.openstreetmap.de/ ). even if the operating system uses IPv6, Java will not use IPv6 in the default configuration

According to http://docs.oracle.com/javase/1.5.0/docs/guide/net/ipv6_guide/#using I will Java net. Preferipv6addresses is set to true to use IPv6 The result of Internet connection disconnection is user error report

It seems that Java only switches to IPv6 address instead of IPv4, but does nothing else All C / C + + based software I maintain has been changed to check and try all available IP addresses, so as long as one of the addresses is valid, the damaged IPv6 (or IPv4) address will be skipped To me, it seems that Java only tries once, which doesn't work in the real world

When IPv6 is transmitted through the tunnel, the OS usually prefers IPv4 to IPv6 It seems that Java also ignores this setting

So my question is: is there any good way to make Java applications use IPv6 by default without destroying the applications of IPv4 users

User error report: http://josm.openstreetmap.de/ticket/8562 , http://josm.openstreetmap.de/ticket/8627.

Solution

So you have two questions:

>The operating system vendor provides an operating system with a corrupted default IPv6 configuration, and / or the user enables a corrupted IPv6 configuration. > When it doesn't work, they will wrongly blame you

You can do two things here:

>It is suggested that users how to disable unnecessary and destructive IPv6 transition mechanisms, such as Teredo, ISATAP and 6to4 Descriptions of these are widely available on the Internet

It is also good if some operating system vendors do not enable this garbage by default, but this may require too much. > Implement happy eyeballs (RFC 6555) in your application This is how modern web browsers solve this problem

Happy eyeballs specifies an algorithm, that is, the application attempts to connect (almost) through IPv6 and IPv4 at the same time. If IPv6 fails to work in a short time, it will fall back to IPv4 connection The results of the experiment were also cached for a few minutes

Unfortunately, I'm not familiar with Java enough to give you specific code to bypass all the interesting things hidden by Oracle by default, but it should be feasible

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>