Name: nt126004 Date: 12/04/2001
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
On win2k multiple ServerSocketChannel object can bind to the same address
without raising a java.net.SocketException, Address already in use. The
following code demonstrates the problem. Running this on a win2k machine
encounters no exception on the second bind call. The same thing on linux-2.4.2
throws an appropriate exception.
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
public class ServerSocketChannelBroken {
public static void main(String[] args) throws Exception {
ServerSocketChannel ssc0 = ServerSocketChannel.open();
ssc0.socket().bind(new InetSocketAddress("127.0.0.1", 1234));
ServerSocketChannel ssc1 = ServerSocketChannel.open();
// This fails correctly on linux-2.4.2 & Solaris but
// surprisingly succeeds on win2k
ssc1.socket().bind(new InetSocketAddress("127.0.0.1", 1234));
}
}
I'm submitting this as a "can't make progress" severity. Of course I could
make progress by not using java.nio.*, but my intention is to use it on
win2k platforms. It really is unusable with this because there is no
satisfactory workaround. If you use a conventional ServerSocket and thread to
accept connections, you are then forced to use a conventional java.net.Socket
rather than a java.nio.channels.SocketChannel, since it is impossible to
instantiate an instance of the latter with an existing socket. Thus the whole
package is unusable for win32.
REGRESSION:
last worked in version 1.4 beta 2
(Review ID: 136264)
======================================================================
|