About Inets and httpd_utils:ip_address/2

View: New views
1 Messages — Rating Filter:   Alert me  

About Inets and httpd_utils:ip_address/2

by Roberto Aloi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

playing a bit with Inets and Erlang Web, my attention went to the  
"httpd_utils" module in inets.
In the ip_address/2 function (last clause), you bind the Inet variable  
to "inet" or "inet6", according to the result of the following piece  
of code:

Inet = case gen_tcp:listen(0, [inet6]) of
               {ok, Dummyport} ->
                   gen_tcp:close(Dummyport),
                   inet6;
               _ ->
                   inet
           end,

Now, on my laptop (Mac OS X 10.6), the listen and the close operations  
both succeed, so I get:

Inet = inet6.

Still,

inet:getaddr("0.0.0.0", inet6).

will fail on my machine, returning:
{error, nxdomain}.

By replacing "inet6" with "inet" I get (as expected):
{ok, {0,0,0,0}}.

This strange (at least for me) behavior, resulted into my Erlang Web  
installation not understanding a:

BindAddress 0.0.0.0

directive in my inets.conf file.

Is this an expected behaviour?

Regards,

Roberto Aloi
roberto.aloi@...
http://www.erlang-consulting.com
---


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