• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to obtain the destination machine information

 
Greenhorn
Posts: 16
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am working on the User login record. Here i have to record the Destination Machine Name, Destination IP address, Source Machine Name and Source IP address. I faced two problems while handling with Servlets.

To obtain the Source Machine Name and Source IP address, we used httpServletRequestObject.getRemoteHost() and httpServletRequestObject.getRemoteAddr(). It is giving me, the same IP address, ie, 127.0.0.1. Is there is any way, how to obtain the Destination Machine Name and Destination IP address.

In our project, we are using proxy server. So whenever client is trying to communicate our application, its request comes through us via proxy server.
Is there is any way to get the client machine ip address and its machine name?

We are using Tomcat 5.5 and J2EE 1.4.

 
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible option would be to modify the header sent from the proxy to include specific client data needed. An additional anecdotal approach is:


- which works 1% of the time depending on the proxy implementation. If your proxy sends that header, it'll contain the client and proxy's ip.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are unlikely to get anything useful. Nearly all users are behind a NAT (Network address translation) service/router. Or a proxy.

When IPv6 is widespread, the need for NAT will decrease. And perhaps the use of NAT will decrease as well. Expect this to happen before the Sun burns out.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pat Farrell wrote:You are unlikely to get anything useful. Nearly all users are behind a NAT (Network address translation) service/router. Or a proxy.

When IPv6 is widespread, the need for NAT will decrease. And perhaps the use of NAT will decrease as well. Expect this to happen before the Sun burns out.



Well, although I'm agreeing with you, I just wanted to point out that NAT is used for more than just to reduce the number of public IPs required by any particular site. It is primarily used to hide the NAT'd machines from the outside network - as a security measure.

I don't think IPV6 will change this.

Best Regards,
 
Praveen mourya Kumar
Greenhorn
Posts: 16
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Charles 'King wrote:One possible option would be to modify the header sent from the proxy to include specific client data needed. An additional anecdotal approach is:


- which works 1% of the time depending on the proxy implementation. If your proxy sends that header, it'll contain the client and proxy's ip.




I tried with the request.getHeader("X-FORWARDED-FOR") . But it gives the null as the result.

Is there is any other way to set the HEADER's environment variable like X-FORWARDED-FOR.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic