[erlang-questions] process: messages from various sources
Dale Harvey
harveyd@REDACTED
Thu Apr 2 13:04:19 CEST 2009
Yes, you just need to make sure the socket
is opened in active mode, or set it to active after
inet:setopts(Socket, [{active, once}]),
2009/4/2 Gamoto <gamoto@REDACTED>
> Is this possible for one process to receive messages from two sources whose
> one of these is a socket ?
>
> Example
>
> my_process(Socket)->
> receive
> {tcp,Socket,Bin}-> %equivalent to
> gen_tcp:recv(Socket,0) ????
> ... %handle Bin
> my_process(Socket); %loop
> {msg,Message} -> %from another process
> ... %handle Message
> i.e gen_send(Socket,Message)
> my_process(Socket); %loop
> end.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090402/50330023/attachment.htm>
More information about the erlang-questions
mailing list