Пример #1
0
 /**
  * Get the IP address of our host. An empty host field or a DNS failure
  * will result in a null return.
  *
  * @param u a URL object
  * @return InetAddress an <code>InetAddress</code> representing the host
  * IP address.
  * @since 1.3
  */
 public function getHostAddress(URL $u)
 {
     if ($u->hostAddress != null) {
         return $u->hostAddress;
     }
     $host = $u->getHost();
     if ($host == null || $host->equals("")) {
         return null;
     } else {
         try {
             $u->hostAddress = InetAddress::getByName($host);
             //            } catch (UnknownHostException $ex) {
             //                return null;
             //            } catch (SecurityException $se) {
             //                return null;
         } catch (\blaze\lang\Exception $e) {
             return null;
         }
     }
     return $u->hostAddress;
 }