[erlang-questions] inet_res:getbyname/2 and udp:connect/3

Dmitry Belyaev rumata-estor@REDACTED
Fri Jun 11 15:15:48 CEST 2010


In fact, the problem appears if first nameserver is 127.0.0.1 and others 
are on another interface.

Dmitry Belyaev


On 06/10/2010 07:10 PM, Dmitry Belyaev wrote:
> I think, we've found a bug in inet_res.
>
> It causes request to inet_res:getbyname/2 to respond {error, timeout} 
> if *first* nameserver in /etc/resolv.conf inexistent (or down in my 
> case).
>
> I couldn't find any info about gen_udp:connect nor 
> erlang:port_get_data/1.
> But commenting following line helped. 
> http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_res.erl#L676
>
> query_udp(S, Id, Buffer, IP, Port, Timer, Retry, I, Tm, Verbose) ->
> Timeout = inet:timeout( (Tm * (1 bsl I)) div Retry, Timer),
> ?verbose(Verbose, "Try UDP server : ~p:~p (timeout=~w)\n", [IP, Port, 
> Timeout]),
> %% udp_connect(S, IP, Port),
> udp_send(S, IP, Port, Buffer),
> query_udp_recv(S, IP, Port, Id, Timeout, Verbose).
>
>
> Can anyone tell me is it really a bug? And what gen_udp:connect/3 do?
>


More information about the erlang-questions mailing list