Hi,

I used InetAddress.getLocalHost().getHostAddress() method before in java 1.6 and i used to get the proper ip address.
Recently I have updated jre to 1.7 and I see InetAddress.getLocalHost().getHostAddress() returns 127.0.0.1 always.
But when I debug my code, i.e when its little slow it gives me proper Ip again.
I have checked the API of InetAddress, getLocalHost() method in java 1.6 and 1.7. The difference I can see is that there is a note added which states:
Note: The resolved address may be cached for a short period of time. .
Is this causing any problem? Is this the way it will behave in Java 1.7? If so then which method should give me the correct ip? Kindly help.