-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
sparc
-
solaris_2.6
Name: acR10002 Date: 08/16/2001
The J2SE v1.4 API spec for ServerSocket.setReuseAddress(boolean on)
specification reads:
-----------------
public void setReuseAddress(boolean on)
throws SocketException
Enable/disable SO_REUSEADDR. This option is set to true by default
when creating ServerSockets.
...
-----------------
However, in fact ReuseAddress is no longer true by default on Windows
since the b75. The following example demonstrates the problem:
---------------- Test.java -------------
import java.net.*;
import java.io.IOException;
public class Test {
public static void main(String args[]) {
try {
ServerSocket soc = new ServerSocket();
System.out.println("SO_REUSEADDR is " + soc.getReuseAddress()
+ " by default");
} catch (IOException e) {
e.printStackTrace(System.out);
}
}
}
---------------------------------------
Test output under Windows 2000:
# java -version
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-beta_refresh-b75)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b75, mixed mode)
# java Test
SO_REUSEADDR is false by default
Everything was working fine in b74 and before:
# java -version
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-beta_refresh-b74)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b74, mixed mode)
# java Test
SO_REUSEADDR is true by default
Please elimintate this inconsistency between the spec and implementation.
======================================================================