1 21 22 package org.opensubsystems.core.util; 23 24 import java.net.InetAddress ; 25 import java.net.UnknownHostException ; 26 27 import org.opensubsystems.core.error.OSSException; 28 29 37 public final class NetUtils 38 { 39 41 44 private NetUtils( 45 ) 46 { 47 } 49 50 52 58 public static String getServerIPAddress( 59 ) throws OSSException 60 { 61 String strAddress; 62 63 try 64 { 65 strAddress = InetAddress.getLocalHost().getHostAddress(); 66 } 67 catch (UnknownHostException eExc) 68 { 69 strAddress = "Unknown address"; 73 } 74 75 return strAddress; 76 } 77 78 85 public static String getServerIPAddressAndName( 86 ) throws OSSException 87 { 88 String strAddress; 89 90 try 91 { 92 strAddress = InetAddress.getLocalHost().toString(); 93 } 94 catch (UnknownHostException eExc) 95 { 96 strAddress = "Unknown address"; 100 } 101 102 return strAddress; 103 } 104 } 105 | Popular Tags |