[erlang-questions] prim_inet:async_recv() received '{inet_async, Socket, Ref, {error, etimedout}}' message

skyman cloudzen@REDACTED
Wed Jul 18 08:27:38 CEST 2012


Hi all,
Below is the code snippet of receive and parse packets from client:


async_recv(Sock, Timeout) when is_port(Sock) ->
    case prim_inet:async_recv(Sock, 0, Timeout) of
        {error, Reason} -> throw({Reason});
        {ok, Res}       -> Res;
        Res             -> Res
    end.


do_parse_packet(Socket, Client) ->
    Ref = async_recv(Socket, 60000),
    receive
{inet_async, Socket, Ref, {ok, <<Cmd:16, Binary/binary>>}} ->
...
{inet_async, Socket, Ref, {error,etimedout}} ->
io:format("Error: etimedout~n")
    end.


Sometimes it receives '{inet_async, Socket, Ref, {error,etimedout}} ' message, what does '{error,etimedout}' mean?
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120718/e1e0a206/attachment.htm>


More information about the erlang-questions mailing list