GeeCON Prague 2014*
The moose likes JSP and the fly likes getRemoteAddr vs getRemoteHost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "getRemoteAddr vs getRemoteHost" Watch "getRemoteAddr vs getRemoteHost" New topic
Author

getRemoteAddr vs getRemoteHost

Adrian Krebs
Greenhorn

Joined: Apr 10, 2002
Posts: 11
Whats the difference from request.getRemoteAddr()
to request.getRemoteHost().
Many thanks!
Adrian
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/javax/servlet/ServletRequest.html
java.lang.String getRemoteAddr()
Returns the Internet Protocol (IP) address of the client that sent the request.
java.lang.String getRemoteHost()
Returns the fully qualified name of the client that sent the request, or the IP address of the client if the name cannot be determined.
for example the first one may give
213.78.93.105
whilst the second might give
213-78-93-105.friaco.onetel.net.uk


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Adrian Krebs
Greenhorn

Joined: Apr 10, 2002
Posts: 11
OK, thank you
 
GeeCON Prague 2014
 
subject: getRemoteAddr vs getRemoteHost