views:

886

answers:

6

Trying to get two erlang nodes talking to each other : one on a Ubuntu machine and one on Windows XP.

We're getting a "Connection attempt from disallowed node" message which prevents one node receiving messages from the other.

They're both using 5.XXX versions of Erlang OTP.

Both nodes have the same cookie ( .erlang.cookie)

We are starting the receiver node with :

erl -name fred@ipaddress

and calling the function on it with 'fred@ipaddress' (in single quotes)

We've turned firewalls off.

So what else may be preventing the connection?

Update : we're using erlang:get_cookie() to check the cookie on both nodes, and the values are different. So is this the problem. We think we're setting the cookie by putting the same .erlang.cookie file in the directory where we run erlang on both machines. But maybe this is the wrong place?

Update 2 : thanks for the answers everyone. We chose Ranok's as our answer because it worked well for us. I'm sure some of the alternative ways of setting the cookie would be fine too.

+1  A: 

A couple of things come to mind:

  1. Have you tried setting the cookie via erlang:set_cookie on both nodes?
  2. If no .erlang.cookie file is found in the $HOME directory, one will be created. Could it be that one of the .erlang.cookie files is not in the right place on one machine? You could search your hard drives for the file and if you find more than the one you created, erlang might have put it there and is using it.
Stefan Schmidt
+1  A: 

Start off by checking each node's cookie. From the shell:

erlang:get_cookie().

If they are not the same, then change one of the node's cookies to match the other:

erlang:set_cookie(node(), "newcookie").

If everything works you need to see why the cookie setting is not being picked from the config file or command line arg.

Tautologistics
+2  A: 

Also, when you start the Erlang system, there is a commandline flag -setcookie which will let you specify the cookie at start time.

erl -name fred@ipaddress -setcookie FOOBAR

Hope that helps, Jacob

Ranok
yep, thanks, that worked a treat
interstar
+2  A: 

The Erlang cookie should be in the users directory. Not the application directory.

So yours is something like:

C:\Documents and Settings\InterstarUser\.erlang.cookie

You can see the location of HOME with the command env in the command line if I remember correctly from my Windows days.

Jon Gretar
+2  A: 

net_adm:ping()

try net_adm:ping() from both nodes.

http://www.erlang.org/documentation/doc-5.4.13/lib/kernel-2.10.13/doc/html/net_adm.html

Flinkman
+1  A: 
erlang:set_cookie(node(), 'newcookie').

not

erlang:set_cookie(node(), "newcookie").
GK