質問

I have three Erlang nodes running on different machines, started as follows:

erl -sname test@box1 -cookie cookie (on one machine)
erl -sname test@box2 -cookie cookie (on another machine)
erl -sname test@box3 -cookie cookie (on a third machine)

Box1 is the master. Box2 and Box3 are workers. When Box1 sends out a task to Box2 and Box3, they both respond with results. However, at this point, Box1 only knows the pids of the Erlang process on Boxes 2 and 3. Is there any way to get the sname for the remote process, given the pid? Or does the remote process have to send back its hostname?

役に立ちましたか?

解決

You can use the node/1 function:

3> node(self()).
nonode@nohost
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top