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

(sc) SocketChannel.read/write throws AsynchronousCloseException on closed channel

    XMLWordPrintable

Details

    • 11
    • b11

    Backports

      Description

        import java.net.SocketAddress;
        import java.nio.ByteBuffer;
        import java.nio.channels.ServerSocketChannel;
        import java.nio.channels.SocketChannel;

        public class NIOTest {
            public static void main(String[] args) throws Exception {
                ServerSocketChannel server = ServerSocketChannel.open();
                server.bind(null);
                SocketAddress saddr = server.getLocalAddress();
                SocketChannel client = SocketChannel.open(saddr);
                System.out.println(client);
                client.close();
                ByteBuffer buf = ByteBuffer.wrap("Hello world".getBytes());
                client.write(buf);
            }
        }

        throws AsynchronousCloseException instead of ChannelClosedException

        Attachments

          Issue Links

            Activity

              People

                ccleary Conor Cleary
                michaelm Michael McMahon
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: