I just tested it, and it seems to work one my local machine.<br>Maybe you omited to "kind of connect" the nodes (help then to discover each others) using net_adm:ping/1 for example?<br><br>Following is my test with output of the 2 VM.
<br><br>VM1:<br>erl -sname e1<br>Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false]<br>Eshell V5.5.4  (abort with ^G)<br>(e1@localhost)1> P1 = spawn(fun() -> receive _ -> ok end end).
<br><0.42.0><br>(e1@localhost)2> global:register_name(test, P1).<br>yes<br>(e1@localhost)3> global:registered_names().<br>[test]<br>(e1@localhost)4> global:whereis_name(test).<br><0.42.0><br><br>VM2:<br>
erl -sname e2<br>Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false]<br>Eshell V5.5.4  (abort with ^G)<br>(e2@localhost)1> net_adm:ping(e1@localhost).<br>pong<br>(e2@localhost)2> global:registered_names().
<br>[test]<br>(e2@localhost)3> global:whereis_name(test).<br><5218.42.0><br><br><br><div><span class="gmail_quote">On 9/19/07, <b class="gmail_sendername">G Bulmer</b> <<a href="mailto:gbulmer@gmail.com">gbulmer@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I apologise for this newbie question, but ...<br>Would someone please explain how to get global:register_name()/
<br>global:whereis_name() to work across nodes?<br><br>I have some very simple, experimental, local-registry based code<br>which looks roughly like this:<br>register(lookup, spawn(fun() -> some_fun() end)),<br><br>and uses this message sending syntax from the 'remote' machine:
<br>{ lookup, '<a href="mailto:server@machine.local">server@machine.local</a>' } ! { some_message }<br><br>This code works okay across nodes on the same machine, and nodes on<br>two machines; so cookie, -name server, etc. seem to be fine.
<br><br>I've tried converting it to use global:register_name(...), etc:<br>Status = global:register_name(lookup, Pid = spawn(fun() -> some_fun()<br>end))<br><br>This returns 'yes' as the value of Status, and seems to work within
<br>the VM that calls global:register_name(), i.e. global:whereis_name<br>(lookup) returns the same pid value as bound to Pid in register_name,<br>and global:registered_names() returns [lookup].<br><br>BUT in a second VM, on the same machine it fails (the 2nd VM is
<br>started with erl -name client). Specifically:<br>global:whereis_name(lookup)   returns 'undefined', and<br>global: registered_names()   returns [].<br><br>I can see the process global_name_server mentioned in the global:
<br>module doc, in response to i() to the shell:<br><0.11.0>              global:init/1<br>233       69    0<br>global_name_server    gen_server:loop/6                       12<br><br>What am I missing?<br>Help and advice would be much appreciated.
<br><br>Garry<br><br><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">
http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>