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

"cannot assign address" when binding ServerSocket on Suse 9

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs
    • None
    • beta
    • x86, sparc
    • linux_2.6, solaris_9

        When IPv6 is enabled on Suse 9 (or JDS 3) it is not possible
        to bind a ServerSocket to the local address.
        App receives a "cannot assign requested address" error
        ###@###.### 2004-12-09 18:17:48 GMT


        Just in case.., test case is here:
        ============ TestCase ===========

        import java.net.*;

        public class TestServer {

         public static void main(String[] args) throws Exception {

           if (args.length != 2) {
             System.out.println("Usage: java TestServer <host_address_ipv6> <port>");
             System.exit(1);
           }

           System.out.println("Host Address="+args[0]);
           System.out.println("Port ="+args[1]);

           ServerSocket ss = new ServerSocket();

           ss.bind(new InetSocketAddress(InetAddress.getByName(args[0]),
           Integer.parseInt(args[1])));

           System.out.println("ServerSocket Bound");

           ss.accept();
         }
        }
        java TestServer <host ipv6 address> <port>

        for host use local link-local address of the host port 5555

        Verify:

        On success, the server socket will be bound to the specified address and port. O
        n failure some exception will be thrown. For
        SuSE Linux ES 9.0, following is thrown:

        Exception in thread "main" java.net.BindException: Cannot assign requested addre
        ss
                at java.net.PlainSocketImpl.socketBind(Native Method)
                at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
                at java.net.ServerSocket.bind(ServerSocket.java:318)
                at java.net.ServerSocket.bind(ServerSocket.java:276)
                at TestServer.main(TestServer.java:17)

        --------------------------------------------------------------------------------
        ---

        System Specification:

        java version "1.4.2_05"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
        Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

        SUSE LINUX Enterprise Server 9 (i586) - Kernel 2.6.5-7.97-default (6)
        ----------------end
        ###@###.### 2004-12-15 19:15:49 GMT

              michaelm Michael McMahon
              michaelm Michael McMahon
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: