strange behaviour with net_kernel:monitor_nodes
luvish satija
luvishsatija@REDACTED
Thu Jun 30 13:58:50 CEST 2005
Hello all,
I am trying to make a simple network monitor. For
that I ran a program consising of the following code
(this is the concept which i'll be using in my
monitor)
-module(mon).
-export([monitor/0,start/0]).
start() ->
net_kernel:connect_node(a@REDACTED),
net_kernel:connect_node(b@REDACTED),
spawn(mon,monitor,[]).
monitor() ->
case net_kernel:monitor_nodes(true) of
ok ->
receive
{nodedown, Node}->
io:format("THE ~p NODE HAS BEEN DOWN and nodes
is ~p.~n",[Node, nodes()])
end,
monitor();
Other ->
io:format("unable to start monitor")
end.
Firstly i started a@REDACTED, b@REDACTED and then i
started my mon. To test, I first killed a@REDACTED and
then b@REDACTED I got the following output:
luvish $ erl -sname mon
Erlang (BEAM) emulator version 5.1 [source]
Eshell V5.1 (abort with ^G)
(mon@REDACTED)1> mon:start().
<0.41.0>
THE a@REDACTED NODE HAS BEEN DOWN and nodes is [b@REDACTED].
THE b@REDACTED NODE HAS BEEN DOWN and nodes is [].
THE b@REDACTED NODE HAS BEEN DOWN and nodes is [].
(mon@REDACTED)2>
Now the problem is that I'm getting the nodedown
message for b@REDACTED two times which is certainly not
desirable. Becuse if some node gets down, then action
should be taken only once. Note that second time, the
value of nodes() is [], so logically, nobody is
connected to mon@REDACTED now but still third line is
printed.
Am i missing something or more then one nodedown
messages are sent (then a should also show the same
behaviour)? Please help me to resolve this confusion.
Thanks in advance,
/luvish
__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
More information about the erlang-questions
mailing list