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:ping
ed 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)?
There's no LAN discovery system in Erlang/OTP right now, but there are a few ways you could go about it:
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)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With