Search code examples
network-programmingerlangejabberderlang-otp

How to connect to a registered Node (Erlang) and use it from Ejabberd


I have a server application with a running node, awaits for rpc calls....

([email protected])>

I have a node started on a different machine in which I have ejabberd running as well

erl -name [email protected] -setcookie somecookie

([email protected])>

And then I have ejabberd server started with ejabberdctl live and I want to be able to ping n2 from n1 ([email protected])>.

I can see that n1 is registered and running with net_adm:names().

I tried to do do directly from code net_adm:ping([email protected]). but it says that system not running with qualified hostname

I need a way to connect/use to n1 and communicate with n2 How to switch to n1 and make the rpc to n2 programatically?


Solution

  • Take a look at your particular ejabberdctl and grep for "name" or "sname". It says if node was started with short name or fully qualified. It must match your "erl -name". Identify one way of naming nodes and alter your node or ejabberd script.