PDA

Click to See Complete Forum and Search --> : Obtain Real-Time (NON-CACHED) IP array?


Nov 6th, 2000, 10:55 PM
How do I obtain the real-time multiple IP addresses for a given machine?

I've used:
InetAddress ip = InetAddress.getLocalHost();//Expect to remain constant
InetAddress mip[] = InetAddress.getAllByName( ip.getHostName() );//Expect to change

When the "multiple IP address array" changes (as when a pc dials an ISP obtaining a dynamically assigned IP) and I call the method again to update mip, I still get the original results. I've found out that there is a caching mechanism in the private method "getAllByName0" which is called by "getAllByName". Perhaps there is a way to flag caching on/off before my call to the public method "getAllByName".

I asked this at http://www.hotdispatch.com/home?aff=75141470 and a reply looked promising:
"Using InetAddressCachePolicy.setIfNotSet InetAddressCachePolicy.FOREVER);
Before you setup SecurityManager.", but I could never find the class "InetAddressCachePolicy" and the person never replied again. I couldn't find the class at java.sun.com either.

Nov 25th, 2000, 09:46 PM
It looks like it is a M$ problem.
http://support.microsoft.com/support/kb/articles/Q273/0/27.ASP

Unfortunately that was the underlying platform.

I'll try it on non-Windows Linux to verify.