org.objectweb.jonas.common
Class NetUtils

java.lang.Object
  extended byorg.objectweb.jonas.common.NetUtils

public class NetUtils
extends java.lang.Object

NetUtils is meant to provide routine network related information to components of JONAS. One of the main purposes is to allow the server to extract it's own IP address correctly. This addresses a bug in java when dealing with Linux boxes on DHCP trying to extract their own IP addresses and always getting the loop back address instead of the external one.

Author:
Vivek Lakshmanan

Field Summary
static java.lang.String LOOP_BACK_ADDR
           
 
Constructor Summary
NetUtils()
           
 
Method Summary
static java.lang.String getLocalAddress()
          Get the string form of the local IP address and not naively assume InetAddress.getLocalHost().getHostAddress() is the currect value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOOP_BACK_ADDR

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

NetUtils

public NetUtils()
Method Detail

getLocalAddress

public static java.lang.String getLocalAddress()
                                        throws java.net.UnknownHostException
Get the string form of the local IP address and not naively assume InetAddress.getLocalHost().getHostAddress() is the currect value. See the class description above for details.

Returns:
A string representing the IPv4 localhost IP address.
Throws:
java.net.UnknownHostException