<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    On 04/08/2022 23:24, <a class="moz-txt-link-abbreviated" href="mailto:mark.yagnatinsky@barclays.com">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>
  </body>
</html>