List of usage examples for java.net InetAddress getHostAddress
public String getHostAddress()
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isMulticastAddress()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isMCOrgLocal()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isMCSiteLocal()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isLinkLocalAddress()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isSiteLocalAddress()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isAnyLocalAddress()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println(address.isMCGlobal()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println("Reach: " + address.isReachable(NetworkInterface.getByIndex(0), 0, 3000)); }
From source file:com.netsteadfast.greenstep.util.HostUtils.java
public static void main(String args[]) throws Exception { Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); for (; nics.hasMoreElements();) { System.out.println("--------------------------------------------------------------------------"); NetworkInterface interfece = nics.nextElement(); System.out.println(interfece.getName()); Enumeration<InetAddress> addrs = interfece.getInetAddresses(); for (; addrs.hasMoreElements();) { InetAddress addr = addrs.nextElement(); System.out.println(addr.getHostAddress()); }/*w w w . jav a 2s. co m*/ } }
From source file:LocalAddress.java
public static void main(String[] args) { System.out.println("OS: " + System.getProperty("os.name") + " vsn: " + System.getProperty("os.version") + " on: " + System.getProperty("os.arch")); InetAddress local = getLocalAddress(); if (local != null) { System.out.println("localAddress: " + local.getHostAddress()); } else {//from w w w .j av a 2 s. c o m System.out.println("localAddress not found"); } }