Skip to content

Instantly share code, notes, and snippets.

@stochastic-thread
Last active August 29, 2015 14:23
Show Gist options
  • Save stochastic-thread/c3116ff1e069e29bde46 to your computer and use it in GitHub Desktop.
Save stochastic-thread/c3116ff1e069e29bde46 to your computer and use it in GitHub Desktop.
Networking question
# From MacBookPro:
iex --name two@192.168.1.255 --cookie monster
:global.register_name(:two, :erlang.group_leader)
# From Windows8:
iex --name one@192.168.1.14 --cookie monster
two = :global.register_name :two, :erlang.group_leader
# Then from Windows8, I can run this:
two |> IO.puts "Hey there!"
# and it prints to MacBookPro's iex session.
# Awesome!
# How can I do the reverse now?
# I tried to do
:global.register_name(:one, :erlang.node)
# but that didn't work because
:erlang.group_leader
# is a PID but
:erlang.node
# is an atom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment