[erlang-questions] reliably figure out hostname

Richard O'Keefe <>
Thu Aug 2 22:58:09 CEST 2012

On 2/08/2012, at 8:40 PM, Gustav Simonsson wrote:

> {ok, LocalHostName} = inet:gethostname().
> inet_res:gethostbyname(LocalHostName).
> You get a hostent record back which has the FQDN.

You *may* do so.  Then again, you may *not*.

Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false]

Eshell V5.6.3  (abort with ^G)
1> {ok, LocalHostName} = inet:gethostname().
2> inet_res:gethostbyname(LocalHostName).

Tested on an intel Core 2 duo Mac running OSX 10.6.8.

More information about the erlang-questions mailing list