Java Network Interface Check isHostInNetworkCard(String host)

Here you can find the source of isHostInNetworkCard(String host)

Description

is Host In Network Card

License

Open Source License

Declaration

public static boolean isHostInNetworkCard(String host) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.InetAddress;

import java.net.NetworkInterface;

public class Main {

    public static boolean isHostInNetworkCard(String host) {
        try {/*from ww  w  . j ava2s.co m*/
            InetAddress address = InetAddress.getByName(host);
            NetworkInterface networkInterface = NetworkInterface.getByInetAddress(address);
            return networkInterface != null;
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. cloneInterfaces( List interfaces)
  2. describeInterface(NetworkInterface subIf, boolean subinterface)
  3. dumpLocalNetworkInfo()
  4. hasNetworkAccess()
  5. isCIDR(String network)
  6. isInterfaceLoopback(NetworkInterface iface)
  7. isInterfaceUp(NetworkInterface iface)
  8. isLoopbackNetworkInterface( NetworkInterface anInterface)
  9. isNetworkAvailable()