tags:

views:

125

answers:

1

I have couple of interconnected computers. On every machine there is running Erlang node and I'd like to communicate with each other passing Erlang terms (peer-to-peer style). However nodes on other computers are listed in nodes() only after I net_adm:pinged them etc. Is there any way how to find out what all nodes (with the same cookie) are on LAN (and without having list of neighbours stored on each computer)?

+3  A: 

There's no LAN discovery system in Erlang/OTP right now, but there are a few ways you could go about it:

  • Read inet:getif() for a list of LAN subnets, and then call (net_kernel():epmd_module()):names(IP) for each IP address in each subnet to collect the list of running nodes, then net_adm:ping() them all to connect. I think this assumes that DNS resolution is working so that you can convert the IP to a name so that the ping will work. (I'm a little rusty on the exact requirements for node connections)
  • Run something like nodefinder on each node. Nodefinder is a discovery library that can use multicast udp to discover Erlang nodes on a LAN.
archaelus
nodefinder is exactly what I need. Thanks.
Jakub Kulhan