[erlang-questions] inet:gethostbyname issue [solved]

Yogish Baliga yogishb@REDACTED
Sat Aug 22 03:56:31 CEST 2009


Got the solution.

Have a inetrc file with the following content

{lookup, [native]}.

set the environment variable ERL_INETRC to the full path name of the inetrc file (default $HOME/.inetrc)

By default dns lookup is done in file, dns, native order

-- baliga


 
"Point of view is worth 80 IQ points" --Alan Kay

http://dudefrommangalore.blogspot.com/





________________________________
From: Michael McDaniel <erlangy@REDACTED>
To: erlang-questions@REDACTED
Sent: Friday, August 21, 2009 3:26:55 PM
Subject: Re: [erlang-questions] inet:gethostbyname issue


On Fri, Aug 21, 2009 at 11:40:14AM -0700, Yogish Baliga wrote:
> erl -name baliga@REDACTED
> 1> inet:gethostbyname("foo").
> {ok, {hostent, "foo"....}}
> 
> erl 
> 1> inet:gethostbyname("foo").
> {ok, {hostent, "foo.example.com"...}}
> 
> When erlang node is started with long node name, inet:gethostbyname/1 return short hostname. But starting erlang node with short node name or no node name, inet:gethostbyname/1 return full hostname.
> 
> Any fix for this?
> 
> Thanx,
> -- baliga
> 
> 
>  
> "Point of view is worth 80 IQ points" --Alan Kay
> 
> http://dudefrommangalore.blogspot.com/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  inet:gethostbyname("delora").  

  works same for me however I started ...


mmcdanie@REDACTED:~/misc/src/erlang/erlview$ uname -a
Linux delora 2.6.24-24-386 #1 Tue Jul 7 19:12:52 UTC 2009 i686 GNU/Linux


mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl
Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
1> inet:gethostbyname("delora").
{ok,{hostent,"delora.autosys.us",
             ["localhost.localdomain","localhost","delora"],
             inet,4,
             [{127,0,0,1}]}}
2> q().
ok
3>


mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -sname fu
Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
(fu@REDACTED)1> inet:gethostbyname("delora").
{ok,{hostent,"delora.autosys.us",
             ["localhost.localdomain","localhost","delora"],
             inet,4,
             [{127,0,0,1}]}}
(fu@REDACTED)2> q().
ok
(fu@REDACTED)3> 


mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu
Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
(fu@REDACTED)1> inet:gethostbyname("delora").
{ok,{hostent,"delora.autosys.us",
             ["localhost.localdomain","localhost","delora"],
             inet,4,
             [{127,0,0,1}]}}
(fu@REDACTED)2> q().
ok
(fu@REDACTED)3>


mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu@REDACTED
Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
(fu@REDACTED)1> inet:gethostbyname("delora").
{ok,{hostent,"delora.autosys.us",
             ["localhost.localdomain","localhost","delora"],
             inet,4,
             [{127,0,0,1}]}}
(fu@REDACTED)2> 



~Michael

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


More information about the erlang-questions mailing list