Java Local Host Get isLocalHost(String h1)

Here you can find the source of isLocalHost(String h1)

Description

is Local Host

License

Open Source License

Declaration

public static boolean isLocalHost(String h1) 

Method Source Code


//package com.java2s;

import java.net.*;

public class Main {
    public static boolean isLocalHost(String h1) {
        boolean ret = false;
        try {/*from   w w w .  ja  v a  2 s .c o m*/
            InetAddress a1 = InetAddress.getByName(h1);
            if (a1 != null)
                ret = InetAddress.getLocalHost().getHostAddress().equals(a1.getHostAddress());
        } catch (UnknownHostException e) {
        }
        return ret;
    }
}

Related

  1. getLocalHostName(boolean includeDomain)
  2. getLocalHostName(boolean useHostname)
  3. getLocalHostNames()
  4. getLocalHosts()
  5. isLocalHost(String address)
  6. isLocalhost(String host)
  7. isLocalhost(String hostname)
  8. isLocalhost(String someHost)
  9. isLocalHostNameInList(String[] hostList)