Erlang tip: passing message between two processes on different nodes

Method 1

On node aa@YongkeDesktop:

(aa@YongkeDesktop)1> net_adm:ping(bb@YongkeDesktop).
pong
(aa@YongkeDesktop)2> erlang:register(yongke, self()).
true

On node bb@YongkeDesktop:

(bb@YongkeDesktop)5> rpc:call(aa@YongkeDesktop, erlang, whereis, [yongke]) ! hello.

On node aa@YongkeDesktop:

(aa@YongkeDesktop)4> flush().
Shell got hello
ok

Method 2

On node aa@YongkeDesktop:

(aa@YongkeDesktop)1> net_adm:ping(bb@YongkeDesktop).
pong
(aa@YongkeDesktop)2> global:register_name(reg_yongke, self()).
yes

On node bb@YongkeDesktop:

(bb@YongkeDesktop)3> global:whereis_name(reg_yongke) ! hello.
hello

On node aa@YongkeDesktop:

(aa@YongkeDesktop)3> flush().
Shell got hello
ok