Socket-Based Distribution

In this section, we will write a simple program using socket-based distribution. As we have seen, distributed Erlang is fine for writing cluster applications where you can trust everybody involved but is less suitable in an open environment where not everyone can be trusted.

The main problem with distributed Erlang is that the client can decide to spawn any process on the server machine. So, to destroy your system, all you’d have to do is evaluate the following:

 
rpc:multicall(​nodes​(), os, cmd, [​"cd /; rm -rf *"​])

Distributed Erlang is useful in the situation where you own all the machines and want to control all of them from a single machine. But this model of computation is not suited to the situation where ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.