<div dir="ltr">Thank you Hugo<br>I created wrapper<br>
<p class="inbox-inbox-p1"><span class="inbox-inbox-s1">[root@ns2.rkn test]# cat test.erl<span class="inbox-inbox-Apple-converted-space"> <br></span></span><font color="#0000ff">-module(test).<br>-export([lookup/0, lookup_wait/0]).<br><br>lookup() -><br><span class="inbox-inbox-Apple-converted-space"> </span>io:format("Called lookup~n"),<br><span class="inbox-inbox-Apple-converted-space"> </span>Result = inet_res:nslookup('<a href="http://example.org">example.org</a>',in,a),<br><span class="inbox-inbox-Apple-converted-space"> </span>io:format("Finished lookup. Result: ~p~n", [Result]).<br><br>lookup_wait() -><br><span class="inbox-inbox-Apple-converted-space"> </span>timer:sleep(5000),<br><span class="inbox-inbox-Apple-converted-space"> </span>io:format("Called lookup_wait~n"),<br><span class="inbox-inbox-Apple-converted-space"> </span>Result = inet_res:nslookup('<a href="http://example.org">example.org</a>',in,a),<br><span class="inbox-inbox-Apple-converted-space"> </span>io:format("Finished lookup_wait. Result: ~p~n", [Result]).</font></p><p class="inbox-inbox-p1"><span class="inbox-inbox-s1"><br>And get following results.<br>NXDOMAIN for lookup call.<br>
</span></p><p class="inbox-inbox-p1"><span class="inbox-inbox-s1">[root@ns2.rkn test]# erl -noshell -run test lookup<br></span><font color="#0000ff">Called lookup<br>Finished lookup. Result: {error,nxdomain}</font></p><p class="inbox-inbox-p1"><span class="inbox-inbox-s1">Correct resolv when called </span>lookup_wait.<br>
</p><p class="inbox-inbox-p1"><span class="inbox-inbox-s1">[root@ns2.rkn test]# erl -noshell -run test lookup_wait<br></span><font color="#0000ff">Called lookup_wait<br>Finished lookup_wait. Result: {ok,<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_rec,<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_header,1,true,query,false,false,true,<br><span class="inbox-inbox-Apple-converted-space"> </span>true,false,0},<br><span class="inbox-inbox-Apple-converted-space"> </span>[{dns_query,"<a href="http://example.org">example.org</a>",a,in}],<br><span class="inbox-inbox-Apple-converted-space"> </span>[{dns_rr,"<a href="http://example.org">example.org</a>",a,in,0,81792,<br><span class="inbox-inbox-Apple-converted-space"> </span>{93,184,216,34},<br><span class="inbox-inbox-Apple-converted-space"> </span>undefined,[],false}],<br><span class="inbox-inbox-Apple-converted-space"> </span>[{dns_rr,"<a href="http://example.org">example.org</a>",ns,in,0,81791,<br><span class="inbox-inbox-Apple-converted-space"> </span>"<a href="http://a.iana-servers.net">a.iana-servers.net</a>",undefined,[],false},<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_rr,"<a href="http://example.org">example.org</a>",ns,in,0,81791,<br><span class="inbox-inbox-Apple-converted-space"> </span>"<a href="http://b.iana-servers.net">b.iana-servers.net</a>",undefined,[],false}],<br><span class="inbox-inbox-Apple-converted-space"> </span>[{dns_rr,"<a href="http://a.iana-servers.net">a.iana-servers.net</a>",a,in,0,168191,<br><span class="inbox-inbox-Apple-converted-space"> </span>{199,43,135,53},<br><span class="inbox-inbox-Apple-converted-space"> </span>undefined,[],false},<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_rr,"<a href="http://a.iana-servers.net">a.iana-servers.net</a>",aaaa,in,0,<br><span class="inbox-inbox-Apple-converted-space"> </span>168191,<br><span class="inbox-inbox-Apple-converted-space"> </span>{8193,1280,143,0,0,0,0,83},<br><span class="inbox-inbox-Apple-converted-space"> </span>undefined,[],false},<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_rr,"<a href="http://b.iana-servers.net">b.iana-servers.net</a>",a,in,0,168191,<br><span class="inbox-inbox-Apple-converted-space"> </span>{199,43,133,53},<br><span class="inbox-inbox-Apple-converted-space"> </span>undefined,[],false},<br><span class="inbox-inbox-Apple-converted-space"> </span>{dns_rr,"<a href="http://b.iana-servers.net">b.iana-servers.net</a>",aaaa,in,0,<br><span class="inbox-inbox-Apple-converted-space"> </span>168191,<br><span class="inbox-inbox-Apple-converted-space"> </span>{8193,1280,141,0,0,0,0,83},<br><span class="inbox-inbox-Apple-converted-space"> </span>undefined,[],false}]}}</font></p><p class="inbox-inbox-p1"><span class="inbox-inbox-s1"><br>Why resolv not work first five second of program start? What to do to resolv this issue?</span></p>
<p class="inbox-inbox-p1"><span class="inbox-inbox-s1">
Sergey</span></p><br></div><br><div class="gmail_quote"><div dir="ltr">вт, 13 дек. 2016 г. в 23:47, Hugo Mills <<a href="mailto:hugo@carfax.org.uk">hugo@carfax.org.uk</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Dec 13, 2016 at 07:52:48PM +0000, Sergey Safarov wrote:<br class="gmail_msg">
> When executed following command from erl shell all works as expected<br class="gmail_msg">
><br class="gmail_msg">
> 1> inet_res:nslookup('<a href="http://example.org" rel="noreferrer" class="gmail_msg" target="_blank">example.org</a>','in','a').<br class="gmail_msg">
<br class="gmail_msg">
inet_res:nslookup/3<br class="gmail_msg">
<br class="gmail_msg">
> [root@ns2.rkn ~]# erl -noshell -s inet_res nslookup '<a href="http://example.org" rel="noreferrer" class="gmail_msg" target="_blank">example.org</a>' 'in' 'a'<br class="gmail_msg">
> {"init terminating in do_boot",{undef,[{inet_res,nslookup,[['<a href="http://example.org" rel="noreferrer" class="gmail_msg" target="_blank">example.org</a><br class="gmail_msg">
> ',in,a]],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}<br class="gmail_msg">
> init terminating in do_boot ()<br class="gmail_msg">
<br class="gmail_msg">
" -s Mod [Func [Arg1, Arg2, ...]](init flag):<br class="gmail_msg">
<br class="gmail_msg">
Makes init call the specified function. Func defaults to<br class="gmail_msg">
start. If no arguments are provided, the function is<br class="gmail_msg">
assumed to be of arity 0. Otherwise it is assumed to be of<br class="gmail_msg">
arity 1, taking the list [Arg1,Arg2,...] as argument. All<br class="gmail_msg">
arguments are passed as atoms. See init(3erl).<br class="gmail_msg">
"<br class="gmail_msg">
<br class="gmail_msg">
Note the fourth sentence: "Otherwise it is assumed to be of arity 1 [...]"<br class="gmail_msg">
<br class="gmail_msg">
so you're actually calling<br class="gmail_msg">
<br class="gmail_msg">
inet_res:nslookup(['<a href="http://example.org" rel="noreferrer" class="gmail_msg" target="_blank">example.org</a>', in, a]) (which doesn't exist)<br class="gmail_msg">
<br class="gmail_msg">
Hugo.<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Hugo Mills | Two things came out of Berkeley in the 1960s: LSD<br class="gmail_msg">
hugo@... <a href="http://carfax.org.uk" rel="noreferrer" class="gmail_msg" target="_blank">carfax.org.uk</a> | and Unix. This is not a coincidence.<br class="gmail_msg">
<a href="http://carfax.org.uk/" rel="noreferrer" class="gmail_msg" target="_blank">http://carfax.org.uk/</a> |<br class="gmail_msg">
PGP: E2AB1DE4 |<br class="gmail_msg">
</blockquote></div>