14
votes

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

1 Answers

17
votes

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.