Results 1 to 1 of 1
- 03-15-2012, 02:13 PM #1Member
- Join Date
- Mar 2012
- Rep Power
InetAddress.getLocalhost() behaving differently in java 1.7
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.
- By sriharshadv87 in forum NetworkingReplies: 0Last Post: 03-08-2012, 06:38 PM
- By BAPandora in forum EclipseReplies: 1Last Post: 04-27-2011, 10:08 AM
- By shahdharmit in forum NetworkingReplies: 1Last Post: 10-18-2009, 02:22 AM
- By Jothi in forum JavaServer Faces (JSF)Replies: 0Last Post: 05-20-2008, 01:22 PM