Hello,
I need to get the Clients machine's IP Address.
I am using JSP/Javascript and JavaBeans. I used Sys_context
option in the oracle.But it is taking only Server machine's IP address. how to take Client's machine's IP address?
What should I do for that?
As for HostName:<%=request.getRemoteHost()%>, you are more likely to the IP address than the actual Host name. Most machines will not give you that info so freely anymore.
Actually it has nothing to do with the host. It has to do with the server and whether to not it performs a reverse DNS lookup for the Hostname.
The other thing you should be aware of when getting a remote address is that 90% of the time the user is going through a proxy or using a NAT address. Thus getting the remote address is only going get that NAT or proxy address not the ACTUAL IP of the machine the the user is browsing from. This is not a problem, it is a reality. On the otherhand you can always use client-side javascript to make the machine cough up the actual IP. This is how Cable and DSL providers typically check to see if you have more than one computer sharing the Cable or DSL line (which is against the EULA for most companies). They get the remote IP in a server-side technology such as ASP or Java and compare it to the IP returned from a client-side DHTML.
Watching DSL and Cable providers get the IP through a client-side script would be entertaining. JavaScript will not work unless you can guarantee that the majority of the users in the world are using Netscape browsers (they are not). Only Netscape browsers support java.net.InetAddress.getLocalHost().getHostAddress().
There is one more semi-consistant way to get the IP on the client side(regardless of the browser), and that is through a Java Applet. Putting security constraints aside, this would eventually set a form value that would get passed back to the server as you suggest. But, remember, the browser must be Java enabled. Nowadays, many are not.
This is all assuming you could make users navigate to a page that has the script or the app to get the IP. This would not be easy. You do realize that you would have to go to one of the companies pages to load the page, right. Then you would have to get the user to click on a form submit button to send your IP to the server. This will not magically work on its own. You could get JavaScript to auto-submit the form for you onLoad. Still you would have to force all users to use the DSL or Cable providers page as a home page. What a mess.
If DSL and Cable providers are checking your IP with this method as you claim, they are not getting what they want and they have been greatly mislead. This is all interesting though, considering we are at a time when providers DON'T CARE as much as in the past about multiple machines on one line.
Know it instead of repeating what your friends tell you!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.