FULL PRODUCT VERSION :
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 8 Release Preview x64
Microsoft Windows [Version 6.2.8400]
A DESCRIPTION OF THE PROBLEM :
Connecting a non-blocking SelectChannel will always throw an exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the example code, which connects to Google.com
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No errors should occur
ACTUAL -
A SocketException is thrown
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.net.SocketException: Invalid argument: getsockname
at sun.nio.ch.Net.localInetAddress(Native Method)
at sun.nio.ch.Net.localAddress(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.*;
import java.nio.channels.*;
public class App {
public static void main(String[] args) throws Exception {
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
sc.connect(new InetSocketAddress("google.com", 80));
}
}
---------- END SOURCE ----------
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 8 Release Preview x64
Microsoft Windows [Version 6.2.8400]
A DESCRIPTION OF THE PROBLEM :
Connecting a non-blocking SelectChannel will always throw an exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the example code, which connects to Google.com
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No errors should occur
ACTUAL -
A SocketException is thrown
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.net.SocketException: Invalid argument: getsockname
at sun.nio.ch.Net.localInetAddress(Native Method)
at sun.nio.ch.Net.localAddress(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.*;
import java.nio.channels.*;
public class App {
public static void main(String[] args) throws Exception {
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
sc.connect(new InetSocketAddress("google.com", 80));
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-7096436 (sc) SocketChannel.connect fails on Windows 8 when channel configured non-blocking
-
- Closed
-