[erlang-questions] Dialyzer and gen_tcp:listen

Koushik Narayanan <>
Sat Dec 27 15:01:19 CET 2008


Hi All,

The gen_tcp:listen function returns an {ok,ListenSocket} or {error,Reason} immediately.

But somehow for code like this:

init([Config_record]) ->
        case inet:gethostbyname(Config_record#config.hostname) of
                {ok, {hostent, _HostName,_Unused,inet,_Ver,[IP]}} ->
                                HTTP_IP = IP;
                _ ->
                        HTTP_IP = {127,0,0,1}
        end,
        {ok,Listen} = gen_tcp:listen(Config_record#config.port,[list,
                                          {ip,HTTP_IP},
                                          {packet,http},
                                          {active, false},
                                          {reuseaddr,true}]),
        do_accept(Listen), %% returns immediately 
        {ok,none}.


The dialyzer says init/1 has no local return.

Why so?

The same code using ssl:listen though passes the dialyzer.


What am I missing here?


Regards,

Koushik Narayanan



More information about the erlang-questions mailing list