Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282522

Error in method setNetworkInterface of MulticastSocket class

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      ADDITIONAL SYSTEM INFORMATION :
      OS=Windows_NT
      PROCESSOR_ARCHITECTURE=AMD64
      PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
      PROCESSOR_LEVEL=6
      PROCESSOR_REVISION=5e03

      C:\Users\user>java -version
      openjdk version "17.0.2" 2022-01-18
      OpenJDK Runtime Environment (build 17.0.2+8-86)
      OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      Error in method setNetworkInterface of MulticastSocket class when InetAddress is instance of Inet4Address, the error ocurrs when try set Net.setInterface6, in line 364 of DatagramChannelImpl class, but the InetAddress is not a instance of Inet6Address.


      ---------- BEGIN SOURCE ----------
      import static org.junit.Assert.assertTrue;
      import static org.junit.jupiter.api.Assertions.*;

      import java.io.IOException;
      import java.net.InetAddress;
      import java.net.MulticastSocket;
      import java.net.NetworkInterface;

      import org.junit.jupiter.api.Test;

      class Test_MulticastSocket {

      @Test
      void test() {
      String sourceIP = "192.168.55.1";
      int pPort = 1418;
      MulticastSocket s = null;

      try {
      s = new MulticastSocket(pPort);
      InetAddress adrs = InetAddress.getByName(sourceIP);
      NetworkInterface ntwIn = NetworkInterface.getByInetAddress(adrs);
      s.setNetworkInterface(ntwIn);
      assertTrue(true);

      } catch (IOException e) {
      if (s != null) {
      s.close();
      }
      fail(e.getMessage());
      }
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: