I am developing web application and i need to know who are all access my web application for that i need ip (ipv4) address of the system which runs my application . i am using jsp and servlet can any one help me to fix this ???
i tried the bellow code but it shows my ip address on every time when ever user access the application.but i need client ip (ipv4) address.
try {
Enumeration e = NetworkInterface.getNetworkInterfaces();
while(e.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) e.nextElement();
System.out.println("Net interface: "+ni.getName());
Enumeration e2 = ni.getInetAddresses();
while (e2.hasMoreElements()){
InetAddress ip = (InetAddress) e2.nextElement();
System.out.println("IP address: "+ ip.toString());
}
}
}
catch (Exception e) {
e.printStackTrace();
}