[erlang-questions] How is hostname decided
Anders Nygren
anders.nygren@REDACTED
Fri Jun 27 00:36:45 CEST 2008
When using short names, how is the hostname decided.
The reason I am asking is that I have a system based on R12B2
running on RedHat Enterprise 4
[npas@REDACTED lib]$ /opt/npas/bin/erl -sname test
Erlang (BEAM) emulator version 5.6.2 [source] [64-bit] [smp:2]
[async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.6.2 (abort with ^G)
(test@REDACTED)1> inet:gethostname().
{ok,"npas"}
Why is the nodename localhost, when inet:gethostname() returns npas?
Looking through the sources I found what looks like the place where hostname is
determined.
inet_config:set_hostname() ->
case inet_udp:open(0,[]) of
{ok,U} ->
Res = inet:gethostname(U),
inet_udp:close(U),
set_hostname(Res);
_ ->
set_hostname({ok, []})
end.
But that also gives "npas"
/Anders
More information about the erlang-questions
mailing list