registering processes

Karel Van Oudheusden voudheus@REDACTED
Fri May 18 11:35:54 CEST 2001


I have a question on distributed computing. 

I have implemented a distributed program on two computers: computer A
and computer B.  Computer A executes the local erlang compiled file
'A.beam' while computer B executes the file 'B.beam'.

'A.erl' is the source code version of 'A.beam'. 'B.erl' is the source
code version of 'B.beam'.

In 'B.erl' I have spawned a process and registered it under a name.  I
have done this by using the 'register(Name, Pid)' command.  This allows
processes on computer A to communicate with this specific process
located on computer B.
The command I used is:  {registeredName, PID} ! message
This works fine.

However, the following does not work:
When a process on computer A communicates with the registered process on
computer B, some new processes are spawned on computer B as a result. 
These newly spawned processes (which are not registered) send their PID
to the processes on computer A. After some time, a process on computer A
tries to send a message to one of these newly spawned processes on
computer B by just using the PID of the latter:  PID ! message

This does not work and if I'm not mistaken, this is because PID's are
only local identifiers of processes.  Therefore I am wandering whether a
command similar to the following exists:  {otherNode(), PID} ! message
In which otherNode() gives the IP address of computer B. 

Stated otherwise, how do I "register" processes that are spawned during
execution of the program, without having to define new names for all
these processes?


More information about the erlang-questions mailing list