Get the hostname (host) and IP address of the current machine

 

 

InetAddress localhost = InetAddress.getLocalHost();
System.out.println("hostName:" + localhost.getHostName());
System.out.println("hostAddress:" + localhost.getHostAddress());
###
hostName:kanpiaoxue.org
hostAddress: 10.27.16.42

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326448244&siteId=291194637