0

I used the following code to get the visitors IPaddress.

<div id="news1"><%=request.getRemoteAddr()%></div>

When I run the code, I get the following output

0:0:0:0:0:0:0:1

Can I know what is actually happening in this line? I am not using any proxy and got this output when connecting from local host.

suraj
  • 1,828
  • 12
  • 36
  • 64

1 Answers1

2

This address is the Loopback address (the IP of your computer, seen from your computer) expressed in IPv6 (usually 127.0.0.1 in IPv4, aliased with host name localhost)

Xavi López
  • 27,550
  • 11
  • 97
  • 161
  • Thank you. In case, if I am connecting through other system, Is there any way to check if visitor is using proxy or not? – suraj Feb 28 '12 at 09:18
  • You could guess if it is by checking for some HTTP header fields, such as [X-Forwarded-For](http://en.wikipedia.org/wiki/X-Forwarded-For), or checking with a list of web proxies. This might be an unreliable practice. It's an interesting enough topic to be a good independent question, like this one [Detecting whether a user is behind a proxy](http://stackoverflow.com/q/1000924/851811). There are good answers there. – Xavi López Feb 28 '12 at 09:33