[erlang-questions] erlang gen_tcp:connect/3 not working with rpc:call/4, anyone knows why?

Allen Kim <>
Wed Sep 21 20:48:57 CEST 2011


I don't see any difference from outputs from the following commands.
It both uses native lookup.
Anyway, it is not a big deal since I do not use Mac for staging nor production. it's only for development.

However, I hope it's better to be consistent on all kind of *nix environment.
Or, it could be me only.

Any Mac user who what to test this?

$ssh   'erl -name  -detached -setcookie loadtest'
$erl -name  -setcookie loadtest
> net_adm:ping('').
> gen_tcp:connect("www.google.com",80,[]).
>rpc:call('',gen_tcp,connect,["www.google.com",80,[]]).


()6> io:format("~p~n",[ets:tab2list(inet_db)]).
[{res_resolv_conf_info,undefined},
 {res_hosts_file_info,undefined},
 {res_domain,"local"},
 {res_hosts_file_tm,0},
 {res_resolv_conf_tm,0},
 {cache_refresh_interval,3600000},
 {socks5_noproxy,[]},
 {res_retry,3},
 {res_search,["local"]},
 {res_resolv_conf,"/etc/resolv.conf"},
 {res_inet6,false},
 {res_recurse,true},
 {hostname,"allen"},
 {res_udp_payload_size,1280},
 {cache_size,100},
 {sctp_module,inet_sctp},
 {udp_module,inet_udp},
 {tcp_module,inet_tcp},
 {res_hosts_file,"/etc/hosts"},
 {res_id,0},
 {socks5_port,1080},
 {res_timeout,2000},
 {res_edns,false},
 {res_alt_ns,[]},
 {socks5_methods,[none]},
 {res_ns,[{{192,168,14,10},53},{{192,168,24,10},53}]},
 {res_usevc,false},
 {socks5_server,[]},
 {res_lookup,[native]}]
ok
()7> io:format("~p~n",[rpc:call('', ets,tab2list,[inet_db])]).
[{res_resolv_conf_info,undefined},
 {res_hosts_file_info,undefined},
 {res_domain,"local"},
 {res_hosts_file_tm,0},
 {res_resolv_conf_tm,0},
 {cache_refresh_interval,3600000},
 {socks5_noproxy,[]},
 {res_retry,3},
 {res_search,["local"]},
 {res_resolv_conf,"/etc/resolv.conf"},
 {res_inet6,false},
 {res_recurse,true},
 {hostname,"allen"},
 {res_udp_payload_size,1280},
 {cache_size,100},
 {sctp_module,inet_sctp},
 {udp_module,inet_udp},
 {tcp_module,inet_tcp},
 {res_hosts_file,"/etc/hosts"},
 {res_id,0},
 {socks5_port,1080},
 {res_timeout,2000},
 {res_edns,false},
 {res_alt_ns,[]},
 {socks5_methods,[none]},
 {res_ns,[{{192,168,14,10},53},{{192,168,24,10},53}]},
 {res_usevc,false},
 {socks5_server,[]},
 {res_lookup,[native]}]
ok



From: Magnus Klaar <<mailto:>>
Date: Wed, 21 Sep 2011 13:18:51 -0500
To: Allen Kim <<mailto:>>
Cc: Kaiduan Xie <<mailto:>>, "<mailto:>" <<mailto:>>
Subject: Re: [erlang-questions] erlang gen_tcp:connect/3 not working with rpc:call/4, anyone knows why?

Hi!

The Erlang VM provides multiple strategies for name lookups, among them is a native lookup mechamism using getaddrinfo and
an erlang client implemented by the inet_res module.

The contents of the inet_db table on the detached node may also be worth looking into, does it differ? which strategy does it use?. You can access it using:

rpc:call('<mailto:>', ets,tab2list,[inet_db]).

You may also want to look into the mDNSResponder daemon that OSX uses as a system-wide resolver. this daemon appears to
be an alternative to the nscd deamon found on GNU/Linux systems. Applications are expected to perform lookups against this daemon.

MVH Magnus

On Wed, Sep 21, 2011 at 7:03 PM, Allen Kim <<mailto:>> wrote:
It IS Mac OS X issue, definitely.
I ran it from CentOS box, and it works fine.
Don't know why it does not work on Mac OS X though.


On 11-09-21 12:35 PM, "Allen Kim" <<mailto:>> wrote:

>$cat /etc/resolv.conf
>#
># Mac OS X Notice
>#
># This file is not used by the host name and address resolution
># or the DNS query routing mechanisms used by most processes on
># this Mac OS X system.
>#
># This file is automatically generated.
>#
>nameserver 192.168.14.10nameserver 192.168.24.10
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110921/853fd48b/attachment.html>


More information about the erlang-questions mailing list