Raimo Niskanen raimo.niskanen@REDACTED
Tue Jun 3 09:05:20 CEST 2003

Yes, it is possible to have several stanard io:s. See the erlang man 
page for module erlang, functions group_leader/0,1.

	  Every process is a member of some process group and all
           groups have a leader.

What is not mentioned is that the group leader is the process that takes 
care of standard output.

The simplest way to find a group leader is to ask one process 
(group_leader/0) perhaps send that group leader to another node, and set 
the group leader for the process that needs to print through the other 
process's group leader.

You can also print on any group leader you have the process identifier 
of, by io:format/3 and such.

It is also very possible to connect to a detached node. If you for 
example start a node with "erl -detached -sname baggins" on the machine 
"shire", and a (server) process on that machine registers the name 
"frodo" - you can send to that process from any other node started with 
the "-sname" flag (having the same magic communication cookie) on the 
same network with for example "{frodo, baggins@REDACTED"} ! {self(), 
hello}", and the communication is started. The process whith registered 
as "frodo" gets a message containing a process identifier that can be 
used to send the reply.

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Jozsef Berces QCZ wrote:
> Is it possible to have several standard io:s for an erlang node? I mean that some processes could send printouts to a different shell. Is it possible to connect to a detached erlang node (started with erl -detached)?
> Thanks in advance,
> Jozsef

More information about the erlang-questions mailing list