mardi 31 mars 2015

Get the ip address of the connected user

I want to get the address of the computer of the connected user (not 127.0.0.1 or the address given by InetAddress ) because i want to restrict the access to my website to only some countries Code frequetly found in the internet:



java.net.InetAddress i = java.net.InetAddress.getLocalHost();
System.out.println(i); // name and IP address
System.out.println(i.getHostName()); // name
System.out.println(i.getHostAddress()); // IP address only




Aucun commentaire:

Enregistrer un commentaire