Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRemoteAddr vs getRemoteHost

 
Adrian Krebs
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the difference from request.getRemoteAddr()
to request.getRemoteHost().
Many thanks!
Adrian
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Adrian Krebs
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic