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

java - How to print docx and pdf? -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

c# - How to use process.StartInfo.Arguments in command prompt? -