서버 IP 가져오기

java 2020. 9. 19. 22:30


InetAddress local;

    try {
        local = InetAddress.getLocalHost();
        String ip = local.getHostAddress();

        System.out.println("local ip : "+ip);
    } catch (UnknownHostException e1) {

        e1.printStackTrace();

    }


https://javacpro.tistory.com/m/47

 

[JAVA/자바] 현재 접속한 서버의 IP 주소 확인

현재 접속한 서버의 IP 주소 확인  어플리케이션 개발중 현재 접속한 서버의 IP 주소를 확인하여 분기처리를 해줘야 하는 부분이 생겨서 이와 관련된 소스를 올립니다.  매우간단합니다. 아래와

javacpro.tistory.com

 

Posted by 張's blog
,