[erlang-questions] inet:gethostbyname question
Raimo Niskanen
raimo+erlang-questions@REDACTED
Mon Jan 18 16:24:18 CET 2010
On Fri, Jan 15, 2010 at 01:24:28PM -0800, Yogish Baliga wrote:
> Strange thing is happening with inet:gethostbyname(inet_db:gethostname()) in R13 release.
Which R13 release is it? The code involved was
extensively rewritten in R13B02.
And what does inet_db:gethostname() acutally return?
>
> inet_db:res_option(lookup).
> [dns,native,file].
> inet:gethostbyname(inet_db:gethostname())
> {error,nxdomain}
> inet_db:set_lookup([dns]).
> inet:gethostbyname(inet_db:gethostname())
> {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}}
>
> Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that
>
> inet_db:res_option(search).
> []
> inet_db:res_option(domain).
> "example.com"
>
> Then I execute,
>
> inet_config:init().
>
> This function is called by inet_db:start_link(), which is called by kernel:init().
>
> After executing inet_config:init(),
>
> inet_db:res_option(search).
> ["sk1.example.com"].
> inet_db:res_option(domain).
> "example.com".
>
>
> After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works.
>
> inet:gethostbyname(inet_db:gethostname()).
> {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}}
>
> Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected?
>
> Thanx,
> -- baliga
>
> "Point of view is worth 80 IQ points" --Alan Kay
>
> http://dudefrommangalore.blogspot.com/
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list