Name: rm29839 Date: 10/24/97
From a send I posted to advanced-java mailing list:
Hello,
I've done the background work on this and didnt find very much that
applied. I have two machines both of which are Solaris 2.5.1 machines.
Specific architecture is as follows:
SunOS pandora 5.5.1 Genric_103640-08 sun4u SUNW,Ultra-Enterprise
One of these machines is dual-homed with two lance interfaces.
The other machine is single homed with a fiber interface.
Lastly, I speculate they are both using some form of DHCP boot.
InetAddress.getLocalHost() under JDK 1.1.3 is returning the address for
localhost/127.0.0.1. This is what is returned by
java.net.InetAddressImpl as provided. One of the threads I read
indicated that this information was gathered from sysinfo, however
initial tests do not seem to confirm that. This simple application
returned the name pandora.
#include <stdio.h>
#include <stdlib.h>
#include <sys/systeminfo.h>
void main() {
char host[512] ;
sysinfo( SI_HOSTNAME, host, sizeof(host) ) ;
printf( "%s\n", host ) ;
}
Is anyone familiar enough with the workings of InetAddressImpl on
Solaris to tell me what might be causing this to occur.
-- Additionally, source code which causes the failure
import java.net.* ;
public class test {
public static void main( String[] args ) throws Exception {
InetAddress addr = InetAddress.getLocalHost() ;
System.out.println( addr.toString() ) ;
System.out.println( addr.getHostName() ) ;
System.out.println( addr.getHostAddress() ) ;
}
}
-- Results
localhost/127.0.0.1
localhost
127.0.0.1
-- Further information, output from ifconfig
ifconfig -a
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
inet 127.0.0.1 netmask ff000000
fddi0: flags=1863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,MULTI_BCAST> mtu 4352
inet 172.16.64.45 netmask ffffff00 broadcast 172.16.64.255
ether 0:40:b:40:e9:7f
======================================================================
- duplicates
-
JDK-4073539 InetAddress get local host fails on Solaris in some cases
-
- Resolved
-