Displaying messages in a remote node IO

Eduardo Figoli eduardo@REDACTED
Sat Dec 21 14:45:34 CET 2002


I have started the code below in Node 1.
I'd like to send a message from Node 2 to Node 1 and display it in Node 1
I don't figure it out what should I modify in this code to do this.

%%%%%%%%%%%%%%%%

-module(logger).
-export([start/0, stop/0]).


start() ->
    spawn(fun() -> init() end).

stop() ->
    logger ! {stop, self()}.
    
init() ->
    register(logger, self()),
    process_flag(trap_exit, true),
    loop().

loop() ->
    receive
 {call, Caller, Msg} ->
      {self(), sender, Msg},
      io:format('Logger closed ~w ~n', Msg)
      loop();
 {stop, Caller} ->
      io:format('Logger closed ~n'),
     exit(normal)
    end.

%%%%%%%%%%%%

Thanks,
Eduardo Figoli
INSwitch Solutions



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


More information about the erlang-questions mailing list