Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Class through which browser is sending local machine's IP address to server  RSS feed

 
Eda Srinivasa Reddy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
As we know we can get the IP address of the machine from which a HTTP request came to a web application using httpServletRequest.getRemoteAddr().
Here my doubt is, in which class the browser is setting the local machine IP address and sending it to the web application?
Actually we have an application, which simulates the browser activity. In this application we wanted to assign a different IP address instead of the local machine's actual IP address. Once we know the above class we can do the rest of the work.
So please help us in finding this class through which the browser is sending the local machine's IP address.
Thanks & Regards
Eda
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch!
The browser isn't setting it. It's in the TCP packets. Anytime you connect to a machine via TCP, that machine knows your IP address. This all happens at a level well below Java.
It is possible to spoof this address, but this is definitely not the kind of thing you should be doing in a test environment.
If you need to test your server code's reaction to a given IP address, you could do this testing in the server process - i.e., use a test stub for the HttpServletRequest object that supplies the dummy IP.
 
ESReddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernest Friedman-Hill
Thank you very much for the information. As you said IP Spoofing is required which is not possible from our tool as of now. So now we are thinking of writing the stubs as you suggested.
Regards
Eda
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!