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

setNetworkInterface() of MulticastSocket failed on V4 machine

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_8

      Description

      setNetworkInterface() of MulticastSocket is giving SocketException on V4 only solaris 8 machine.Its working fine with V4/V6 solaris machine.

      How to reproduce:

      Execute the following code with machine name as argument.

      import java.net.*;
      import java.io.*;
      import java.util.*;

      public class Mcast1 {

          public static void main(String[] arg) {


              try {
                      String readerName=null;
                      NetworkInterface niface=null;
                      int MCAST_DEFAULT_PORT_V4 = 26500;

                      readerName=arg[0];

                      niface = NetworkInterface.getByAddr(InetAddress.getByName(readerName));

                      MulticastSocket ms = new MulticastSocket(MCAST_DEFAULT_PORT_V4);

                      System.out.println("Network interface" + niface);

                      System.out.println("Before set network interface");
                      ms.setNetworkInterface(niface);

                      System.out.println("After set interface");

                      InetAddress iadr = InetAddress.getByName("224.0.0.1");
                      ms.joinGroup(iadr);
                      System.out.println("working....");
                 } catch(Exception exp) {
                      exp.printStackTrace();
                      System.out.println("exp message: " + exp.getMessage());
                 }
          }

      }


      Executed the above code as:

      $ java Mcast1 impulse

      Output:
      ------
      Network interfacename:hme0 (hme0) index: 2 addresses:
      /10.7.130.15;

      Before set network interface
      java.net.SocketException: IPV6_MULTICAST_IF failed (interface has IPv4 address only?)
              at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
              at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:243)
              at java.net.MulticastSocket.setNetworkInterface(MulticastSocket.java:392)
              at Mcast1.main(Mcast1.java:23)
      exp message: IPV6_MULTICAST_IF failed (interface has IPv4 address only?)


      Other Information:

      Its working fine on dual stack(V4/V6) solaris 8 machine.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              vakellasunw Venkata Akella (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: