-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
sparc
-
solaris_2.6
Name: dfR10049 Date: 06/18/2001
java.net.MulticastSocket.setLoopbackMode() always throws SocketException.
Javadoc states:
Disable/Enable local loopback of multicast datagrams The option is
used by the platform's networking code as a hint for setting whether
multicast data will be looped back to the local socket.
Because this option is a hint, applications that want to verify what
loopback mode is set to should call getLoopbackMode()
But Javadoc does not specify when SocketException should be thrown.
This is the test demonstrating the bug:
------------------------------------------------------------------
import java.net.*;
import java.io.*;
public class Test {
public static void main (String args[]){
try {
MulticastSocket ms = new MulticastSocket();
boolean val = ms.getLoopbackMode();
ms.setLoopbackMode(val);
} catch (IOException e) {
e.printStackTrace(System.out);
System.out.println("Test failed");
return;
}
System.out.println("Test passed");
}
}
---------------------------------------------------------------------
output from the test:
#> java Test
java.net.SocketException: Invalid argument
at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:245)
at java.net.MulticastSocket.setLoopbackMode(MulticastSocket.java:512)
at Test.main(Test.java:13)
Test failed
======================================================================