• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Get the Remote machine IP address

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I need to get the remote IP address of the machine using my web application .
I need to get this address without using servlet concept.
can you help me out.

If the remote client uses proxy server, then how to get the real IP address.

Thanks.
 
Rancher
Posts: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I need to get this address without using servlet concept.



Your question is rather vague , so I do not know whether it helps you, that javax.servlet.ServletRequest has the methods


 
Ivan Jozsef Balazs
Rancher
Posts: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But of course if the client sits behind a firewall, you won't learn its IP address.

Also if there is clustering or a firewall etc. before your servlet, then the "raw" IP-address won't help you either.
In this case, if we talk about HTTP requests, they can get added a header with the original IP address.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And of course the actual IP address of the host on the other end is generally meaningless, since in many (most?) cases it will be a private IP address. I could be talking to 50 different hosts at once, spread all over the globe, and all with an IP address of 192.168.1.2.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeff Verdegan wrote:And of course the actual IP address of the host on the other end is generally meaningless, since in many (most?) cases it will be a private IP address. I could be talking to 50 different hosts at once, spread all over the globe, and all with an IP address of 192.168.1.2.



This is correct, but I wanted to make it clear that ServletRequest.getRemoteAddr() will return the public address of the firewall or NAT box; it won't ever return such a private address.

sudhir pavan, as you can see, this is neither possible nor meaningful: even if you could get that address -- which you generally could not, not without client-side code like a signed applet, anyway -- it would often be worthless to you.

 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic