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

Allen Kim allen.kim@REDACTED
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 allen@REDACTED  'erl -name loadtest@REDACTED -detached -setcookie loadtest'
$erl -name allen@REDACTED -setcookie loadtest
> net_adm:ping('loadtest@REDACTED').
> gen_tcp:connect("www.google.com",80,[]).
>rpc:call('loadtest@REDACTED',gen_tcp,connect,["www.google.com",80,[]]).


(allen@REDACTED)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
(allen@REDACTED)7> io:format("~p~n",[rpc:call('loadtest@REDACTED', 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 <magnus.klaar@REDACTED<mailto:magnus.klaar@REDACTED>>
Date: Wed, 21 Sep 2011 13:18:51 -0500
To: Allen Kim <allen.kim@REDACTED<mailto:allen.kim@REDACTED>>
Cc: Kaiduan Xie <kaiduanx@REDACTED<mailto:kaiduanx@REDACTED>>, "erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>" <erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>>
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('loadtest@REDACTED<mailto:loadtest@REDACTED>', 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 <allen.kim@REDACTED<mailto:allen.kim@REDACTED>> 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" <allen.kim@REDACTED<mailto:allen.kim@REDACTED>> 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.htm>


More information about the erlang-questions mailing list