Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7181882

Non-blocking SocketChannel connect doesn't work on Windows 8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • core-libs
    • x86
    • windows_7

      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 ----------

            alanb Alan Bateman
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: