Re: Local IP address / Java Incompatibility

1998-10-12 Thread Bernd Eckenfels
On Mon, Oct 12, 1998 at 04:18:54PM +0200, Rainer Dorsch wrote:
> We found an incompatibility between Java on Solaris 2.5.1/2.6 and on Debian 
> 2.0.r2 Could anybody suggest how to find out, if it is a bug in Debian Linux 
> or JDK?

You have to use getLocalHost() on a connected Socket, not on InetAddress to
get the local address of the socket.

Greetings
Bernd

> 
>   InetAddress inetadr = InetAddress.getLocalHost();
>   System.out.println("LocalIP:   " + inetadr.getHostAddress());
>   System.out.println("LocalName: " + inetadr.getHostName());
> 
-- 
  (OO)  -- [EMAIL PROTECTED] --
 ( .. )  [EMAIL PROTECTED],linux.de,debian.org} http://home.pages.de/~eckes/
  o--o *plush*  2048/93600EFD  [EMAIL PROTECTED]  +497257930613  BE5-RIPE
(OO)   If privacy is outlawed only Outlaws have privacy



Re: Local IP address / Java Incompatibility

1998-10-12 Thread Rainer Dorsch

Yes, it works now! Thanks.

Could anybody think of negative implications of doing this reverse ordering of 
the localhost and ip address entries?

> Rainer Dorsch wrote:
> > 
> > We found an incompatibility between Java on Solaris 2.5.1/2.6 and on Debian
> > 2.0.r2 Could anybody suggest how to find out, if it is a bug in Debian Linux
> > or JDK?
> > 
> Put the hostname above the localhost entry
> in the /etc/hosts.
> 
> I believe it's a libc/glibc fault.
> 
> Joe
> 
> -- 
> Joe Carter  Software Engineer
> Brite Voice Systems Ltd, Gatley, Cheshire. UK.
> mailto:[EMAIL PROTECTED]
> 

-- 
Rainer Dorsch
Abt. Rechnerarchitektur  e-mail:[EMAIL PROTECTED]
Uni StuttgartTel.: 0711-7816-215




Local IP address / Java Incompatibility

1998-10-12 Thread Rainer Dorsch
We found an incompatibility between Java on Solaris 2.5.1/2.6 and on Debian 
2.0.r2 Could anybody suggest how to find out, if it is a bug in Debian Linux 
or JDK?

Additions to the included bug report:

- $ hostname -i
  129.69.183.3

  gives the correct answer in a shell.

- Debian 2.0 comes with jdk-1.1.5v5-1


Thanks.



--- Begin Message ---
Hello!

I have tried to get the IP address and host name of the host running my 
Java application using the following Java-Code:

  InetAddress inetadr = InetAddress.getLocalHost();
  System.out.println("LocalIP:   " + inetadr.getHostAddress());
  System.out.println("LocalName: " + inetadr.getHostName());

This works well for a SUN system, but I always get 127.0.0.1 and
localhost on my Debian Linux system. Is this a bug in Linux-Java or
is there any other way to determine the name and IP address of my
localhost???

Can anyone help me?

bye Thomas!


Below are some of my System.Properties:

-- listing properties --
user.language=en
java.home=/usr/lib/jdk1.1/bin/..
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
file.encoding.pkg=sun.io
java.version=cls:03/11/11-08:49
file.separator=/
line.separator=
 
file.encoding=8859_1
java.vendor=Sun Microsystems Inc., ported by Rand...
user.timezone=CET
user.name=schwarts
os.arch=x86
os.name=Linux
java.vendor.url=http://java.blackdown.org/java-linux
user.dir=/home/hiwi/schwarts/RAJava
java.class.path=.:/usr/lib/jdk1.1/bin/../classes:/usr...
java.class.version=45.3
os.version=2.0.33
path.separator=:
user.home=/home/hiwi/schwarts

--- End Message ---
-- 
Rainer Dorsch
Abt. Rechnerarchitektur  e-mail:[EMAIL PROTECTED]
Uni StuttgartTel.: 0711-7816-215