[4706] in java-interest

home help back first fref pref prev next nref lref last post

Re: misplaced method

daemon@ATHENA.MIT.EDU (Elliotte Rusty Harold)
Thu Jan 11 12:05:49 1996

From: "Elliotte Rusty Harold" <elliotte@blackstar.com>
To: flar@bendenweyr.eng.sun.com (Jim Graham)
Date:          Thu, 11 Jan 1996 11:03:41 EST
Reply-To: elliotte@blackstar.com
Cc: java-interest@java.sun.com


> getHostName() is the correct interface, but there is a bug in
> getByName that sets the hosts "name" to the IP address so that
> getHostName just returns it rather than doing the reverse lookup.
> 
> This should work:
> 
>  byte addr[] = {129, 144, 86, 116};
>  String host = new InetAddress(null, addr).getHostName();
> 

This fails because there's no constructor matching InetAddress(null, 
byte array) in java.net.InetAddress. In fact there are no 
constructors in there at all. (You also need to cast those ints to 
bytes but that's easuily done.)

--
Elliotte Rusty Harold    Black Star Publishing Co., Inc.
elliotte@blackstar.com   116 East 27th Street
elharo@shock.njit.edu    NY NY 10016
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post