[erlang-questions] multi sending

Ulf Wiger <>
Thu Mar 5 08:29:09 CET 2009


alekciy wrote:
> In doc write: "
> Expr1 ! Expr2
> Sends the value of Expr2 as a message to the process specified by Expr1."
> 
> How I can send one message to many process similar multicast in LAN? Only
> inside loop?

The expression (Pid ! Msg) returns Msg, so if you know the
pids or registered names of the recipients, you can write

P1 ! P2 ! P3 ! ... ! Msg

Otherwise, a loop, e.g. [ P ! Msg || P <- Pids]

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com



More information about the erlang-questions mailing list