com.gridsystems.utils
Class NetUtils

java.lang.Object
  extended by com.gridsystems.utils.NetUtils

public final class NetUtils
extends java.lang.Object

Network utilities.

Author:
dsanchez, Xmas

Method Summary
static boolean areFreePorts(int[] ports)
          Check if a list of ports are free.
static boolean checkPort(int portNumber)
          Checks whether a port is available for opening.
static java.lang.String[] getAllIPs()
           
static java.lang.String getMachineIP()
           
static void main(java.lang.String[] args)
          Utility application.
static boolean serverIsLocal(java.lang.String host)
          Helper method to know if certain server ip or server name is our machine or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkPort

public static boolean checkPort(int portNumber)
Checks whether a port is available for opening.

Parameters:
portNumber - the port number
Returns:
true if the port is available, false otherwise

getAllIPs

public static java.lang.String[] getAllIPs()
Returns:
All IPs of this machine.

getMachineIP

public static java.lang.String getMachineIP()
Returns:
Return best IP for this machine.

serverIsLocal

public static boolean serverIsLocal(java.lang.String host)
Helper method to know if certain server ip or server name is our machine or not.

Parameters:
host - The host name to test
Returns:
true if host is (or is an alias to) localhost

areFreePorts

public static boolean areFreePorts(int[] ports)
Check if a list of ports are free.

Parameters:
ports - The port numbers to test
Returns:
true if all ports are free in this host

main

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

Parameters:
args - Arguments


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.