Help coderanch get a
new server
by contributing to the fundraiser
  • 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

LAN ID from the servlet

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

Is it possible to identify the lan id from the HttpServletRequest object?Consider that all the users are connected in the same network.

Regards,
M.S.Raman
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is a "LAN ID"?

In any case, if it's possible at all from inside a JVM to figure out the "LAN ID" in which the JVM is running, then it should be possible to do the same from a servlet (running inside a servlet container which is running inside a JVM).
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, and regardless of how you define "LAN ID", I doubt you can deduce it from HttpServletRequest.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, you can retrieve the IP address of the machine sending the request from the ServletRequest.
Of course if the request came in via a firewall or proxy this address will be the address of that firewall or proxy and not that of the actual client machine.

Apart from that, there's no information you can get (most specifically, the MAC address of the calling machine is not available).
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

public java.lang.String getRemoteHost()



For getting the client host.
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I think we can able to retrieve only the client IP Address and not their system Local Area Network ID?

Regards,
M.S.Raman
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:


For getting the client host.




In hereal world, i thing, this method is ineficiency and not good.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:



In hereal world, i thing, this method is ineficiency and not good.



Why is this inefficient ?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Malli Raman:
Hi,

I think we can able to retrieve only the client IP Address and not their system Local Area Network ID?

Regards,
M.S.Raman



The IP address IS a unique ID on the network (or network segment).
I suggest you read up on network architecture...

And no, you can't get the MAC address of the client.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:


Why is this inefficient ?





Because in real world , each ip (real ip) have more one machine(computer) ,
some proxy that you can not know who use this ip.
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:




Because in real world , each ip (real ip) have more one machine(computer) ,
some proxy that you can not know who use this ip.



Yes. I agree with you, It won't provide better solution.

-M.S.Raman
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:




Because in real world , each ip (real ip) have more one machine(computer) ,
some proxy that you can not know who use this ip.



In the real world each IP address maps to exactly ONE (1) machine on the subnet.
That machine itself may handle requests for many machines (act as a proxy) but it's still one machine only.

There's no way around this. Even if you COULD get the MAC address you'd still get the MAC address of the proxy.
That's the definition of a proxy after all, everything behind it is a black box to everything on the other side.
 
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic