[erlang-questions] net_adm:localhost() return value for -sname?

Jouni Ryno Jouni.Ryno@REDACTED
Fri Jan 30 07:49:25 CET 2009


The manual says about net_adm:localhost():
"Returns the name of the local host. If Erlang was started with the
-name command line flag, Name is the fully qualified name."

The manual is kind of correct, as at least in my Debian Lenny it gives
the long name in both cases. But to me the wording kind of implies, that
localhost could return the short name, if started with -sname.

ryno@REDACTED:/proj/egse$ erl -name test
Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0]
[kernel-poll:false]
Eshell V5.6.3  (abort with ^G)
(test@REDACTED)1> net_adm:localhost().
"adic.fmi.fi"
(test@REDACTED)2> 

ryno@REDACTED:/proj/egse$ erl -sname test
Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0]
[kernel-poll:false]
Eshell V5.6.3  (abort with ^G)
(test@REDACTED)1> net_adm:localhost().
"adic.fmi.fi"

My /etc/hosts
ryno@REDACTED:$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 adic.fmi.fi adic

wondering, what was the intention?
Jouni
-- 

  Jouni Rynö                            mailto://Jouni.Ryno@fmi.fi/
                                        http://space.fmi.fi/~ryno/
  Finnish Meteorological Institute      http://www.fmi.fi/
  P.O.BOX 503                           Tel      (+358)-9-19294656
  FIN-00101 Helsinki                    FAX      (+358)-9-19294603
  Finland                               priv-GSM (+358)-50-5302903
  
  "It's just zeros and ones, it cannot be hard"




More information about the erlang-questions mailing list