[erlang-questions] EPmail-0.1 released
Johan Wärlander
johan@REDACTED
Sat Jan 29 08:54:14 CET 2011
I'll look closer at the code when I get to the office, but initially I can
say that if your gen_fsm should receive data from the socket, you need to
transfer ownership to the new process.. Something like:
{ok, Pid} = supervisor:start_child(...),
gen_tcp:controlling_process(Sock, Pid),
...
Check docs for gen_tcp, not sure of that function call.
Eh.. Tedious to type on the phone :)
//Johan
Den 29 jan 2011 08.21 skrev "Alexander Kuleshov" <kuleshovmail@REDACTED>:
> Thank you Johan for help.
>
> I try to supervisor start_child gen_gsm:
>
> accept(Socket) ->
> case gen_tcp:accept(Socket) of
> {ok, Sock} ->
> Child = {popd_fsm, {popd_fsm, start_link, [Sock, [], []]},
> permanent, 2000, worker, [popd_fsm]},
>
> supervisor:start_child(popd_sup, Child),
> gen_tcp:send(Sock, "+OK POP3 server ready \r\n"),
> accept(Socket);
> {error, Reason} ->
> Reason
> end.
>
> My popd_fsm src - https://gist.github.com/801635.
>
> It's work normal only with 1 client. When i connect 2 client and more
> it's crash.
>
> I add {next_state, autorization, State}. in the autorization/2 it's
> not crash, but work only for one client.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
More information about the erlang-questions
mailing list