コード例 #1
0
 // return IP given name or IP
 String getMachineIP(String name) {
   try {
     IPAddr inet = IPAddr.getByName(name);
     return inet.getHostAddress();
   } catch (UnknownHostException e) {
     return null;
   }
 }
コード例 #2
0
ファイル: Exporter.java プロジェクト: edina/lockss-daemon
 protected String getHostIp() {
   try {
     IPAddr localHost = IPAddr.getLocalHost();
     return localHost.getHostAddress();
   } catch (UnknownHostException e) {
     log.error("getHostIp()", e);
     return "1.1.1.1";
   }
 }
コード例 #3
0
 String getLocalIPAddr() {
   if (localAddr == null) {
     try {
       IPAddr localHost = IPAddr.getLocalHost();
       localAddr = localHost.getHostAddress();
     } catch (UnknownHostException e) {
       // shouldn't happen
       log.error("LockssServlet: getLocalHost: " + e.toString());
       return "???";
     }
   }
   return localAddr;
 }