games.strategy.net
Class IPFinder

java.lang.Object
  extended by games.strategy.net.IPFinder

public class IPFinder
extends java.lang.Object


Constructor Summary
IPFinder()
           
 
Method Summary
static java.net.InetAddress findInetAddress()
          We iterate through an enumeration of network interfaces on the machine and picks the first IP that is not a loopback and not a link local and not private.
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
 

Constructor Detail

IPFinder

public IPFinder()
Method Detail

findInetAddress

public static java.net.InetAddress findInetAddress()
                                            throws java.net.SocketException,
                                                   java.net.UnknownHostException
We iterate through an enumeration of network interfaces on the machine and picks the first IP that is not a loopback and not a link local and not private. In the case of IRIX computers connected on a LAN through a central gateway running java off a telnet session will result in a null network interface (patched below).

Returns:
java.net.InetAddress the ip address to use
Throws:
java.net.SocketException - required by InetAddress
java.net.UnknownHostException - required for getLocalHost()

main

public static void main(java.lang.String[] args)
                 throws java.net.SocketException,
                        java.net.UnknownHostException
Throws:
java.net.SocketException
java.net.UnknownHostException