My code needs to insert ip address of the machine it is running upon. I am doing this by,
InetAddress IP = InetAddress.getLocalHost();
String hostAddress = IP.getHostAddress().trim();
//insert ip into DB
Now my client rightly informed me that when tested this code on different machines, all inserted ip as 127.0.0.1. I undertand that machines are network and thus returning local host ip.
but how to resolve this? I need uniq ip address of individual box.