...
>I'm having a terrifically difficult time ...
>... I think it's a Win2K problem, but I'm not sure.
Testing beats suspicion 9 times out of ten*.
So keeping that in mind arrange these..
>NetworkInterface.getNetworkInterfaces
>NetworkInterface.getInetAddresses
>InetAddresses.getCanonical name.
..into an SSCCE** and I will provide some test
results for this Win XP Pro box.
* ..and 83.7% of statistics are invented on the spot.
** <http://www.physci.org/codes/sscce.html>

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Lew - 05 Oct 2007 14:31 GMT
chrisrocker90@gmail.com wrote:
>> I'm having a terrifically difficult time getting the hostname of my
>> computer to resolve to the correct, external IP address (as opposed to
>> 127.0.0.1). I think it's a Win2K problem, but I'm not sure. I'm
>> posting here in case someone knows about it, and in case I'm mistaken
>> and it is just a java problem.
> Testing beats suspicion 9 times out of ten*.
> So keeping that in mind arrange these..
> ..into an SSCCE** and I will provide some test
> results for this Win XP Pro box.
> ** <http://www.physci.org/codes/sscce.html>
Hmm, could this be a clue?
chrisrocker90@gmail.com wrote:
>> Canonical Name: Chris <---- computer name
>> hostAddress: 127.0.0.1
,,,
>> Canonical Name: ROCK <---- computer name
>> hostAddress: 192.168.12.20
And you say "Chris" resolves to 127.0.0.1, and "ROCK" resolves to 192.168.12.20?
Coincidence?

Signature
Lew
chrisrocker90@gmail.com - 06 Oct 2007 13:21 GMT
> chrisrocke...@gmail.com wrote:
> >> I'm having a terrifically difficult time getting the hostname of my
[quoted text clipped - 23 lines]
> --
> Lew
No, not a coincidence - it's a result of how the OS is resolving the
computer name differently on separate hosts. On both machines, I
want the address to resolve to external ip addresss. On "Chris", it's
not doing that correctly, on "ROCK", it is.
Lew - 06 Oct 2007 14:55 GMT
>> chrisrocke...@gmail.com wrote:
>>>> Canonical Name: Chris <---- computer name
[quoted text clipped - 13 lines]
> want the address to resolve to external ip addresss. On "Chris", it's
> not doing that correctly, on "ROCK", it is.
Um, well, you see, err, my comment was based on my misunderstanding of what
you wrote, which is why I canceled it. Sorry about that.

Signature
Lew
mark.donaghue@gmail.com - 05 Oct 2007 14:59 GMT
> chrisrocke...@gmail.com wrote:
>
[quoted text clipped - 12 lines]
> .into an SSCCE** and I will provide some test
> results for this Win XP Pro box.
Of course, you are right. Here is the code:
import java.net.*;
import java.util.*;
public class GetPublicHostName {
public static void main (String args[]) throws Throwable{
System.out.println("abc");
NetworkInterface iface = null;
for (Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
ifaces.hasMoreElements();){
System.out.println("efg");
iface = (NetworkInterface)ifaces.nextElement();
System.out.println("xInterface:" + iface.getDisplayName());
InetAddress ia = null;
for (Enumeration ips = iface.getInetAddresses();
ips.hasMoreElements();){
ia = (InetAddress)ips.nextElement();
System.out.println(ia.getCanonicalHostName() + " " +
ia.getHostAddress());
}
}
}
}
> * ..and 83.7% of statistics are invented on the spot.
>
[quoted text clipped - 4 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
Andrew Thompson - 06 Oct 2007 15:19 GMT
..(provide)
>> ...SSCCE** and I will provide some test
>> results for this Win XP Pro box.
>
>... Here is the code:
...
>public class GetPublicHostName {
abc
efg
xInterface:MS TCP Loopback interface
localhost 127.0.0.1
efg
xInterface:SiS 900-Based PCI Fast Ethernet Adapter
210.49.14.119 210.49.14.119

Signature
Andrew Thompson
http://www.athompson.info/andrew/
> I'm having a terrifically difficult time getting the hostname of my
> computer to resolve to the correct, external IP address (as opposed
> to 127.0.0.1). I think it's a Win2K problem, but I'm not sure. I'm
> posting here in case someone knows about it, and in case I'm
> mistaken and it is just a java problem.
I'm inclined to think this is a host configuration problem.
/gordon
--