• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRemoteAddr() vs. getRemoteHost()

 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I'm using the ServletContext.log() method to log each incoming user request. I've used getRemoteAddr() and getRemoteHost() method of request. In the log file I only get to see the loopback addr.-127.0.0.1> What's the basic diff. btw. these two methods?

Any help shall be highly appreciated.
Thanks,
Reema
 
Akbar Upadyayula
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Reema,

both are same and getRemoteAddr() gives you the internet protocol (IP)address of the client, getRemoteHost() gives you the fully qualified name of the client .
some times both methods may return the same i.e. IP address of the client system
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or see this thread where this topic already discussed.

hope it helps..
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ranchers!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic