T
Thomas Richter
Hi folks,
consider a Linux machine with a temporary internet connection that is
shut down/reconnected occasionally and that receives its hostname
(when applicable) via DHCP. If I'm shutting the running network
connection down with "ifdown eth0", then
java.net.InetAddress.getLocalHost()
fails with an "UnknownHostException".
What's that supposed to say? There *is* always a local host,
and its name is "localhost", so why does it fail? And if
so, how could it fail?
Aparently, the sytem host name (returned by gethostname(2)) is
still that one assigned by the DHCP server, which is now invalid,
by why is *that* address of any interest since "localhost" would
always be apropriate?
Greetings,
Thomas
consider a Linux machine with a temporary internet connection that is
shut down/reconnected occasionally and that receives its hostname
(when applicable) via DHCP. If I'm shutting the running network
connection down with "ifdown eth0", then
java.net.InetAddress.getLocalHost()
fails with an "UnknownHostException".
What's that supposed to say? There *is* always a local host,
and its name is "localhost", so why does it fail? And if
so, how could it fail?
Aparently, the sytem host name (returned by gethostname(2)) is
still that one assigned by the DHCP server, which is now invalid,
by why is *that* address of any interest since "localhost" would
always be apropriate?
Greetings,
Thomas