problem with gethostbyname/1
Sean Hinde
sean.hinde@REDACTED
Mon Oct 13 21:46:27 CEST 2003
On Monday, October 13, 2003, at 08:22 pm, David Wallin wrote:
> Hi all,
>
> This is under Gentoo Linux (2.4.20) Pentium 4, could someone give me a
> clue as to why this happens:
>
> Eshell V5.3 (abort with ^G)
> 1> inet:gethostbyname("wintermute").
> {error,nxdomain}
> 2> inet_res:gethostbyname("wintermute").
> {ok,{hostent,"wintermute.csis.ul.ie",[],inet,4,[{136,201,24,71}]}}
> 3> halt().
>
Erlang has a ton of different ways to do name lookup, though the whole
mechanism for choosing which one(s) are used appear to be undocumented,
and it involves digging around in all sorts of UNIX files in /etc and
elsewhere. You can find out which methods are being used with
1> inet_db:res_option(lookup).
[native,file]
(example from my mac)
And force a setting by creating a .inetrc file in your home directory
containing:
{lookup, ["native", "file"]}.
Options appear to be:
"bind", "dns", "hosts", "files", "file", "yp", "nis", "nisplus",
"native"
Some mechanisms appear to use internal dns code, others spawn external
port programs. It is a bit of a minefield but there may be enough clues
to sort it out.
My sympathies!
Sean
More information about the erlang-questions
mailing list