org.jboss.remoting.transport
Class PortUtil

java.lang.Object
  extended by org.jboss.remoting.transport.PortUtil

public class PortUtil
extends java.lang.Object

PortUtil is a set of utilities for dealing with TCP/IP ports

Version:
$Revision: 5342 $
Author:
Jeff Haynie, Tom Elrod

Field Summary
static java.lang.String MAX_PORT
           
static java.lang.String MIN_PORT
           
 
Constructor Summary
PortUtil()
           
 
Method Summary
static boolean checkPort(int p, java.lang.String host)
          Checks to see if the specified port is free.
static int findFreePort(java.lang.String host)
          Will try to find a port that is not in use up to 50 tries, at which point, will throw an exception.
static int getMaxPort()
           
static int getMinPort()
           
static int getRandomStartingPort()
           
static void main(java.lang.String[] args)
           
static void setMaxPort(int maxPort)
           
static void setMinPort(int minPort)
           
static void updateRange(java.util.Map config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_PORT

public static final java.lang.String MIN_PORT
See Also:
Constant Field Values

MAX_PORT

public static final java.lang.String MAX_PORT
See Also:
Constant Field Values
Constructor Detail

PortUtil

public PortUtil()
Method Detail

checkPort

public static boolean checkPort(int p,
                                java.lang.String host)
Checks to see if the specified port is free.

Parameters:
p -
Returns:
true if available, false if already in use

findFreePort

public static int findFreePort(java.lang.String host)
                        throws java.io.IOException
Will try to find a port that is not in use up to 50 tries, at which point, will throw an exception.

Returns:
Throws:
java.io.IOException

getRandomStartingPort

public static int getRandomStartingPort()

getMinPort

public static int getMinPort()

setMinPort

public static void setMinPort(int minPort)
                       throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

getMaxPort

public static int getMaxPort()

setMaxPort

public static void setMaxPort(int maxPort)

updateRange

public static void updateRange(java.util.Map config)

main

public static void main(java.lang.String[] args)


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.