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.
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.
- duplicates
-
JDK-4418866 setInterface fails on Solaris 8 if interface doesn't have IPv6 address
-
- Closed
-