Java Host Address Get getHostAddress()

Here you can find the source of getHostAddress()

Description

get Host Address

License

Open Source License

Declaration

public static String getHostAddress() 

Method Source Code

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

import java.net.InetAddress;

public class Main {
    public static String getHostAddress() {
        String strIP = "";
        try {/* w  w w.  jav  a  2s.  co  m*/
            InetAddress thisIp = InetAddress.getLocalHost();
            strIP = thisIp.getHostAddress();
        } catch (Exception e) {
            e.printStackTrace();
            strIP = "";
        }
        return strIP;
    }
}

Related

  1. getHostAddress()
  2. getHostAddress()
  3. getHostAddress()
  4. getHostAddress()
  5. getHostAddress()
  6. getHostAddress()
  7. getHostAddress()
  8. getHostAddress()
  9. getHostAddress(boolean promiscuous)