org.jboss.remoting.transport
Class PortUtil
java.lang.Object
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: 4281 $
- Author:
- Jeff Haynie, Tom Elrod
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 |
getRandomStartingPort()
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PortUtil
public PortUtil()
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()
main
public static void main(java.lang.String[] args)
Copyright © 1998-2005 JBoss Inc . All Rights Reserved.