jsp - How to get client public ip address in servlet java -


this question has answer here:

i using tomcat server java web application. need client public ip address request. unable that, used request.getheader("x-forwarded-for") request.getremoteaddr() methods client machine local ip address.

you running server in local network. if in wild request.getremoteaddr()should job.

if need in local network public ip same in local network since behind router or uses nat dosen't make sense in eyes. though if want public ip use service ipecho: http://ipecho.net/plain


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -