[erlang-questions] gen_tcp:recv and hairloss

Colm Dougan colm.dougan@REDACTED
Sat Nov 8 18:27:26 CET 2008


On Sat, Nov 8, 2008 at 4:23 PM, Kevin <q2h46uw02@REDACTED> wrote:
>
> loop(Sock, Fsm) ->
>    case gen_tcp:recv(Sock, 0, ?RECV_TIMEOUT) of %% this works!
>    {ok, Request} ->
>          ok = gen_tcp:controlling_process(Sock, Fsm), %% {error,not_owner}
>          ok = gen_fsm:send_event(Fsm, {Request, Sock}),
>          loop(Sock, Fsm)
>    {error, Reason} ->
>            ok = gen_tcp:close(Sock),
>    end.

There isn't really enough code here to know enough about what the
problem could be. It looks like you have 2 processes both of which
want  to go back and forth receiving from the same socket but I'm not
really clear why you just can't use 1 processes to do all the socket
handling.   If you were to post a listing of both modules or at least
enough code to demonstrate the problem then I'm sure we could be more
help.

Colm



More information about the erlang-questions mailing list