Using Zig to implement an Erlang C Node.
zig master
(this was created with the0.11.0-dev.2371+a31450375
build), you can just doasdf install
in the root folder if you useasdf
with thezig
plugin.
From the root directory
$ zig build run
This starts the Zig node.
From another terminal, run a iex
shell with:
$ iex --sname foo
Now you can connect to the Zig node with (replacing yourhostname
with the hostname of the machine
you're executing this example on):
iex> Node.connect(:"zig@yourhostname")
And send a message with:
iex> send(:global.whereis_name(:ziggy), {self(), :hello})
The Zig node expects message in the format {pid(), atom()}
. If you send :ping
as atom, the Zig
node will reply to the pid contained in the message with the :pong
atom.
iex> send(:global.whereis_name(:ziggy), {self(), :ping})
iex> flush()
:pong
:ok