[erlang-questions] process: messages from various sources

Gamoto <>
Thu Apr 2 15:14:35 CEST 2009


After what ? where should I add your line ?

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 <>

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

http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090402/07d2a649/attachment.html>


More information about the erlang-questions mailing list