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

SocketListeningConnector does not allow invocations with port 0

XMLWordPrintable

    • b14


        SocketListeningConnector.startListening does not allow several invocations with port 0

        according to

        http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/conninv.html

        Socket Listening Connector does not require a port to be specified (and it finds available port itself in this case).
        Unfortunately it does not work if called consequently if previous connection was not yet accepted.

        See attached test case.

        There is a check inside GenericListeningConnector preventing listening with the same params as before but it
        seems that it should be aware of auto detecting ports (0).

        I expect SocketListeningConnector.startListening to work as many times as I need with unspecified (auto) port.
        In the test case provided I get an exception:

        Exception in thread "main"
        com.sun.jdi.connect.IllegalConnectorArgumentsException: Already listening
        at com.sun.tools.jdi.GenericListeningConnector.startListening(GenericListeningConnector.java:110)
        at com.sun.tools.jdi.SocketListeningConnector.startListening(SocketListeningConne ctor.java:85)
        at Listen2.main(Listen2.java:15)

              dtitov Daniil Titov (Inactive)
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: