my dog learned polymorphism
The moose likes Servlets and the fly likes IP of the Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "IP of the Client" Watch "IP of the Client" New topic

IP of the Client

Karthik Prabu
Ranch Hand

Joined: Dec 27, 2002
Posts: 48
Hi All,
Is there any way to find the IP of the Client requesting a servlet other tha the getRemoteHost() and getRemoteAddr() API's.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
I sure don't know of any - whats wrong with using those ServletRequest methods? The whole idea of ServletRequest is that it encapsulates all the client request information.
Mauro Velasco

Joined: May 13, 2003
Posts: 7
I need the Ip and Mac Address from a client, How can I do? with a servlet on iAS.
best regards
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

This question gets asked over and over again. You can search this forum for some of the detailed explanations, but in short, the IP address isn't reliable for identification puposes. Not only can it be spoofed, but it's often translated in the course of ordinary network operations. Plus there's DHCP.
MAC addresses probably would require a JNI glue class, but they're no more trustworthy. If you want a positive ID, look at some sort of certificate exhange. For most purposes, J2EE's security framework is adequate, however, and it doesn't break if the user's PC dies and they end up having to log in from someone else's box.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: IP of the Client
It's not a secret anymore!