[erlang-questions] (no subject)

Stefan Hellkvist hellkvist@REDACTED
Mon Sep 23 08:01:39 CEST 2013


Hi,

Here is a question about why I sometimes get an etimedout error from
gen_tcp:recv.

I open a tcp socket on the server side using lines like:

{ok, LSock} = gen_tcp:listen(Port, [binary, {packet, line}, {active,
false}]),
{ok, Sock} = gen_tcp:accept(LSock),
do_recv(Sock).


where do_recv is something like this:


do_recv(Sock) ->
    case gen_tcp:recv(Sock, 0) of
        {ok, Data} ->

            do_recv(Sock);

        {error, Reason} ->
        ?DAWN_EVENT("tcp_bus got error and shut down: ~p", [Reason]),
        telnet_subscriber:unsubscribe({Sock, self()})
    end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130923/a3864748/attachment.htm>


More information about the erlang-questions mailing list