<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>On 5/08/2022 4:44 pm, Alan Bateman wrote:<br>
    </p>
    <blockquote type="cite"
      cite="mid:5e0e4376-afec-4663-d44c-f61b53bec865@oracle.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      On 04/08/2022 23:24, <a class="moz-txt-link-abbreviated
        moz-txt-link-freetext"
        href="mailto:mark.yagnatinsky@barclays.com"
        moz-do-not-send="true">mark.yagnatinsky@barclays.com</a> wrote:<br>
      <blockquote type="cite"
cite="mid:MN2PR12MB36162731F151952E20C9048CF99F9@MN2PR12MB3616.namprd12.prod.outlook.com">
        <meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
        <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal">I suspect that this is the wrong list;
            please redirect me if so.<o:p></o:p></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">The docs for this method:<o:p></o:p></p>
          <p class="MsoNormal"><a
href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/InetAddress.html#getLocalHost()"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/InetAddress.html#getLocalHost()</a><o:p></o:p></p>
          <p class="MsoNormal">say that it “Returns the address of the
            local host. This is achieved by retrieving the name of the
            host from the system, then resolving that name into an
            InetAddress.”<o:p></o:p></p>
          <p class="MsoNormal">This is true enough in simple cases, but
            horribly misleading in non-trivial cases.<o:p></o:p></p>
          <p class="MsoNormal">As far as I can tell it can’t return “the
            address” because the local host may have multiple addresses.<o:p></o:p></p>
          <p class="MsoNormal">Instead it returns “an address” of the
            local host.  My laptop right now has 3 addresses: IPv6
            loopback, IPv4 from home WiFi, and IPv4 from company network
            via VPN.<o:p></o:p></p>
          <p class="MsoNormal">As far as I can tell (please correct me
            if I’m wrong!!) if there are multiple addresses, the current
            implementation makes no effort to pick a more “useful” one.<o:p></o:p></p>
          <p class="MsoNormal">Instead, it takes whatever addresses it
            gets from the OS and returns the first one.<o:p></o:p></p>
          <br>
        </div>
      </blockquote>
      You need to click through to the Networking Properties to read
      more about configuration. The long standing default has been to
      prefer IPv4 over IPv6 addresses. The OpenJDK net-dev mailing list
      is the place to follow-up on this.<br>
      <br>
      -Alan<br>
    </blockquote>
    <p>Set the following property to prefer IPv6:</p>
    <p>java.net.preferIPv6Addresses=TRUE</p>
    <p>In our software we also use this property to determine whether to
      prefer IPv4 or IPv6, eg multicast. 
<a class="moz-txt-link-freetext" href="https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-discovery-providers/src/main/java/org/apache/river/discovery/x500/sha512withrsa/package.html">https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-discovery-providers/src/main/java/org/apache/river/discovery/x500/sha512withrsa/package.html</a></p>
    <p>It's always good to utilise existing properties when possible.<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Regards,
 
Peter</pre>
  </body>
</html>