inet:gethostbyname question

Yogish Baliga <>
Fri Jan 15 22:24:28 CET 2010


Strange thing is happening with inet:gethostbyname(inet_db:gethostname()) in R13 release.

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/


More information about the erlang-questions mailing list