Getting the 'external' IP address in Java

前端 未结 12 1868
自闭症患者
自闭症患者 2020-11-22 15:08

I\'m not too sure how to go about getting the external IP address of the machine as a computer outside of a network would see it.

My following IPAddress class only g

12条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 15:47

    If you are using JAVA based webapp and if you want to grab the client's (One who makes the request via a browser) external ip try deploying the app in a public domain and use request.getRemoteAddr() to read the external IP address.

提交回复
热议问题