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

Per Hedeland <>
Wed Jun 16 01:15:29 CEST 2010


Tony Rogvall <> wrote:
>
>> gen_udp:recv(U, 0, 1000).              
>{error,econnrefused}             <==================
>
>> gen_udp:recv(U, 0, 1000).
>{error,timeout}
>
>
>Working?

Seems so.

>Maybe you missed the first recv?

No.

>Maybe I am missing something?

Dunno - but it doesn't work for me:

$ uname -msr
FreeBSD 7.2-RELEASE i386
$ erl
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
1> {ok,U} = gen_udp:open(0).
{ok,#Port<0.427>}
2> inet:setopts(U, [{active, false}]).
ok
3> gen_udp:connect(U, "127.0.0.1", 12345).
ok
4> gen_udp:send(U, <<1,2,3>>).
ok
5> gen_udp:recv(U, 0, 1000).
{error,timeout}               (after ~ 1 second)

What version of OTP did you try on? What OS?

--Per


More information about the erlang-questions mailing list