Is how distribution "works" specified anywhere?

Joe Armstrong joe@REDACTED
Mon May 17 20:55:22 CEST 2004

On Mon, 17 May 2004, Luke Gorrie wrote:

> Joe Armstrong <joe@REDACTED> writes:
> >   Is there any internal  documentation that specifies how distribution
> > works?
> In "on the wire" terms, check out this file in the OTP sources:
>   erts/emulator/internal_doc/erl_ext_dist.txt  
> The distribution messages all map simply onto BIFs (SEND, EXIT, etc)
> and it's easy to understand.
> >   How  are  things  organised  with  remote Pids?   is  a  remote  Pid
> > distinguishable from a  local Pid - if  so how?
> The PID structure includes a node name.

Aggh - yes.

  Hack city - It seems I can cheat like this:

  Suppose I have  an Erlang running on  and that to
send  messages to  It I  must use  port 111,  I'd like  to  embed this
infromation into all Pids created by this Erlang system.

I can do this as follows. If I write:

	$ erl -sname "111-host-some-where-se"

Then create a Pid

	> (111-host-some-where-se@REDACTED)1> P=spawn(fun() -> true end).

        (111-host-some-where-se@REDACTED)2> node(P).

It seems like this string gets embedded in the Pid, since

	> term_to_binary(P).

  Which means  if I  do term_to_binary on  anything containing  a Pid,
then ship  it over  the net using  any transport  method - then  I can
extract the string  111-host-some-where-se from the reconstructed term
on any  node and thus know  that the Pid  came from
and that I have to use port 111 to talk to it.

 BTW What is a valid node name?
 I'd like to have written the node name like this:

 erl -sname '56:'
{error_logger,{{2004,5,17},{20,50,7}},'Invalid node name: ~p~n',['56:']}


 But this crashes the system.


> Luke

More information about the erlang-questions mailing list