Can messages be sent to processes interactively?

James Hague jhague@REDACTED
Thu May 20 18:33:42 CEST 1999


I've been doing a lot of sequential programming in Erlang, but have just
started getting into concurrency.  It seems very obvious and
straightforward.

I wrote a quickie test process so I can start it up and send messages to
it interactively, just so I know that all is well:

-module(sample).
-export([start/0]).

start() -> spawn(sample, server, []).

server() ->
   receive
      stop -> ok;
      Msg  ->
         io:fwrite("message received: ~w\n", [Msg]),
         server(N)
  end.

This compiles just fine, and I can start the process from the Erlang
prompt with P = sample:start(), which results in a valid pid.  "P ! 1."
from the command line, though, doesn't result in any fwrite output,
though.  process_info(P) returns an atom of 'undefined'.

Is it not possible to do this sort of thing interactively?  I've only
tried this using JAM under Windows.  I haven't tried it with BEAM on my
Linux box yet.

James





More information about the erlang-questions mailing list