问题
Given that I can send PIDs from a process to an other, even across nodes, if I receive a Pid from a process within a different process (possibly on a different node) how do I find out which node the PID in question runs in/on?
erlang:process_info(Pid)
does not seem to have that information in it.
Thanks.
回答1:
erlang:node/1
node(Arg) -> Node
Returns the node where Arg is located. Arg can be a pid, a reference, or a port. If the local node is not alive, nonode@nohost is returned.
来源:https://stackoverflow.com/questions/7083980/how-do-i-found-out-which-node-an-erlang-process-is-running-on