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

SocketChannel.connect() throws unexpected exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • x86, sparc
    • solaris_2.6, windows_98



      Name: auR10023 Date: 11/19/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b28"
      JCK : 1.5
      Platform[s] : Win98
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/java_nio/channels/SocketChannel/index.html#Methods[SocketChannel0002]


      Problem description
      ===================
      Method java.nio.channels.SocketChannel.connect() throws unexpected exception on windows 98.
          
      Minimized test:
      ===============
      ------- t.java -------
      import java.net.*;
      import java.io.*;
      import java.nio.channels.*;

      public class t {
          public static void main(String[] args) throws IOException {
              ServerSocket soc = new ServerSocket(0);
              int port = soc.getLocalPort();
              ServerSocket serverSocket = new ServerSocket();
              SocketChannel channel = SocketChannel.open();
              channel.configureBlocking(true);
              InetSocketAddress addr = new InetSocketAddress(
                  InetAddress.getLocalHost(), port);

              System.out.println(addr);
              serverSocket.bind(addr);
              channel.connect(addr);
          }
      }

      ------- end-of-t.java -------

      Minimized test output:
      ======================
      namespace/192.168.205.171:1826
      Exception in thread "main" java.net.SocketException: Bad address: connect
              at sun.nio.ch.Net.connect(Native Method)
              at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464)
              at t.main(t.java:17)


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
          
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: