[erlang-questions] Communicating processes

Fredrik Hoback fredrik.hoback@REDACTED
Mon Mar 26 20:05:04 CEST 2007


Hi, I'm having some trouble with inter-process communication. First  
of all I have a process which receives a message it looks something  
like this:

%%%%%%%%%%%%%%%%%%%%%%%%
receive_msg() ->
	receive
		{Msg} ->
		io:format("Recieved Message");
		_->
		io:format("Nothing to report")
	end.
%%%%%%%%%%%%%%%%%%%%%%%%
Note: this process is spawned and registered as proxy.

To continue: I have another module which I start from within the  
shell it looks similar to this:

%%%%%%%%%%%%%%%%%%%%%%%%
send_message()->
	Msg = "Hello World", 	% My message
	send(Msg),			% here I send my message somewhere unknown and the  
reply is sent to the process proxy above
						%Here I want to receive the message that is received in proxy
%%%%%%%%%%%%%%%%%%%%%%%%

So how to I accomplish this? Is there any other way then using " ! "?  
What I would like to do is to call the process proxy from within  
send_message and the return answer should be Msg, is this possible?  
And how should it look?


------------------------------------
Fredrik Hoback
fredrik.hoback@REDACTED



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070326/8f0e0353/attachment.htm>


More information about the erlang-questions mailing list