Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest. getRemoteAddr() is different from ipconfig /all

 
noodle hamilton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all:
I have deployed my web app locally on my own box. I however didn't not resolve to localhost, i used my own computer name instead...
but what happen is i did a test. I try to access the local web app, make a few requests...
the result of getRemoteAddr() is different from what ipconfig /all give it to me..even though I am doing everything on the same computer..

could somebody explain to me why that is the case???


Many thanks...
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you getting from getRemoteAddr() ? Is that 127.0.0.1
 
noodle hamilton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, i was getting a different ip, it is not 127.0.0.1

it has the same subnet value as what i get from ipconfig /all
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by noodle hamilton:
no, i was getting a different ip, it is not 127.0.0.1


What do you see when you do ping <machineName> ?
 
Rajesh Agarwal
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
127.0.0.1 is the IP address used to loopback to own machine. this means if we try to connect to 127.0.0.1 , if gets routed to own machine. In other words 127.0.0.1 is you. A ping on local host also returns 127.0.0.1 while your machine might have an IP address
 
Sutham Rojanusorn
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you sure that you have network connected? or any proxy attached?
please check
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic