problem getting two erlangs to chat

Vance Shipley vances@REDACTED
Wed Sep 3 23:40:25 CEST 2003


Gary,

The two nodes don't know about each other until you tell them.
When you use the functions in net_adm the node contacts epmd
to discover other noides known to that instance of epmd.  This
doesn't happen automatically at startup.  You can check this
by running erlang:nodes(), it will return an empty list.

To make your system work the way you expect it to you can predefine
the hosts containing nodes you want connected in an .hosts.erlang
file.  You can find this documented with the kernel:net_adm module.
Then you put the net_adm:world() command in the $HOME/.erlang
file.  This tells erlang to look at the .hosts.erlang file on
startup and contact epmd on each of the hosts mentioned in that
file.  Every node known to those epmds will now be known.

While you're at it you can put any other initialization you wish 
in the .erlang file.  If you always perform the same actions on
startup put thise commands in here.  For some fun on a rainy day
look at stdlib:shell_default which allows you to create command
syntax files so that in the shell you can do:

	1> foo().

and have it run some long command(s).

You can eliminate the "-setcookie cookie" options to your command
lines if both nodes are started by the same user on the same host.
The first node will create a $HOME/.erlang.cookie file containing
the randomly chosen cookie (perms 400).  The second node will use
that file to set it's cookie.  This also works with C nodes.

	-Vance

Vance Shipley
Motivity Telecom Inc.
+1 519 240 3684
vances@REDACTED


On Wed, Sep 03, 2003 at 03:55:08PM -0400, Garry Hodgson wrote:
}  
}  
}  i'm having a problem getting two erl's to talk to each other.
}  i suspect this'll be obvious to y'all, but i's escaping me.



More information about the erlang-questions mailing list