[erlang-questions] process: messages from various sources

Gamoto gamoto@REDACTED
Thu Apr 2 12:10:32 CEST 2009


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.




More information about the erlang-questions mailing list