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

select() for OP_WRITE on socketchannel hangs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • x86
    • windows_nt



      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)


        To duplicate bug:
      Compile appended code, and run. First message shows up,
      but second message does not. This only happens on Win32.
      Sometimes, after close to an hour, the second message will
      appear.

      import java.nio.channels.Selector;
      import java.nio.channels.SocketChannel;
      import java.nio.channels.SelectionKey;

      import java.net.InetSocketAddress;

      import java.io.IOException;

      public class bug
      {
          public static void main(String a[])
              throws IOException
          {
              Selector select = Selector.open();

              SocketChannel sc =
                  SocketChannel.open
                  (new InetSocketAddress("java.sun.com", 80));

              sc.configureBlocking(false);
              sc.register(select, SelectionKey.OP_WRITE);

              System.out.println("Waiting to be able to write to java.sun.com:80");
              select.select();
              System.out.println("Select returns once");
              select.select();
              System.out.println("Select returns twice");
              sc.close();
          }
      }
      (Review ID: 136324)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: