반응형
자바 서버 ip
-
[java] 자바 서버 ip 가져오기Java/Java Library 2021. 2. 25. 18:13
public static String getIp(){ String result = null; try { result = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { result = ""; } return result; } InetAddress.getLocalHost().getHostName() 을 사용하면 서버에서 hostname 을 찾는것과 같은 이름을 찾는다.