7. C Nodes
7 C Nodes
This section outlines an example of how to solve the example problem in Problem Example
by using a C node. Notice that a C node is not typically used for solving simple problems like this, a port is sufficient.
7.1 Erlang Program
From Erlang's point of view, the C node is treated like a normal Erlang node. Thus, calling the functions foo
and bar
only involves sending a message to the C node asking for the function to be called, and receiving the result. Sending a message requires a recipient, that is, a process that can be defined using either a pid or a tuple, consisting of a registered name and a node name. In this case, a tuple is the only alternative as no pid is known:
{RegName, Node} ! Msg
The node name Node
is to be the name o