Uploaded image for project: 'JBoss Remoting'
  1. JBoss Remoting
  2. JBREM-289

PortUtil only checking for free ports on localhost

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.4.0 beta
    • Fix Version/s: 1.4.0 final
    • Component/s: general
    • Labels:
      None

      Description

      The PortUtil class has the following method:

      public static boolean checkPort(int p)
      {
      boolean available = true;
      ServerSocket socket = null;
      try

      { socket = new ServerSocket(p); }

      catch(IOException e)

      { log.debug("port " + p + " already in use. Will try another."); available = false; }

      finally
      {
      if(socket != null)
      {
      try

      { socket.close(); }

      catch(IOException e)
      {

      }
      }
      }
      return available;

      }

      problem is that just using ServerSocket(p) creates the socket on the localhost and can not specify particular bind address.

      Also, the way is coded now, will continue to loop forever looking for a port.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tom.elrod Tom Elrod
                Reporter:
                tom.elrod Tom Elrod
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: