<div dir="ltr">Hi Dan<br><br> The first thing that comes to mind is, does the generic_tcp_server register itself? If so, the second one will fail to start. Do you see any error messages? I find if you start SASL before you run your program, you may get better error information (application:start(sasl), or -boot sasl on the command line). Anotyher possibility is, could one of them have died before you looked in appmon? What does your output/error log look like?<br>
<br>The other thing is, instead of explicitly looking in registered() for your connection monitor, you coud just use whereis():<br><br><span style="font-family: courier new,monospace;">case whereis(<font size="2">?CONNCOUNTER) of<br>
undefined -> % Not registered<br> </font></span><font style="font-family: courier new,monospace;" size="2"><span></span>register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections)
end)),</font><font style="font-family: courier new,monospace;" size="2"><br> error_logger:info_msg("TCP server <~p> started TCP connection
monitor.~n", [self()])</font><span style="font-family: courier new,monospace;">;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Pid -></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"><font size="2"> error_logger:info_msg(<br> "TCP connection monitor (~p) already
registered as ~p ...SKIPPING~n",<br> [?CONNCOUNTER, Pid]<br> )</font></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end</span><br><br>Hope this helps.<br>
<br><div class="gmail_quote">2008/9/22 <span dir="ltr"><<a href="mailto:Dana.RUBINO@rbs.com">Dana.RUBINO@rbs.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><span><font size="2" face="Arial">Hi
all,</font></span></div>
<div><span><font size="2" face="Arial"></font></span> </div>
<div><span><font size="2" face="Arial">I have a simple
supervisor setup which is watching two worker processes.</font></span></div>
<div><span><font size="2" face="Arial"></font></span> </div>
<div><span><font size="2" face="Arial">Now I have created
the init method as such:</font></span></div>
<div><span><font size="2" face="Arial"></font></span> </div>
<div><span>
<p align="left"><font size="2">init(Args) -></font></p>
<p align="left"><font size="2"><span>
</span>[{port,Port},{maxconns, MaxConnections},{sockethandlermod,
SocketHandlerMod}] = Args,</font></p>
<p align="left"><font size="2"></font></p>
<p align="left"><font size="2"><span>
</span>Registered = registered(),</font></p>
<p align="left"><font size="2"><span>
</span>case lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered)
of</font></p>
<p align="left"><font size="2"><span> </span>true
-> </font></p>
<p align="left"><font size="2"><span>
</span>error_logger:info_msg("TCP connection monitor (~p) already
registered...SKIPPING~n",[?CONNCOUNTER]);</font></p>
<p align="left"><font size="2"><span> </span>false
-> </font></p>
<p align="left"><font size="2"><span>
</span>register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections)
end)),</font></p>
<p align="left"><font size="2"><span>
</span>error_logger:info_msg("TCP server <~p> started TCP connection
monitor.~n", [self()])</font></p>
<p align="left"><font size="2">end,</font></p>
<p align="left"><font size="2"></font> </p>
<p align="left"><font size="2">GenTcpServer1 =
{'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},</font><font size="2">permanent,2000,worker,[generic_tcp_server]},</font></p>
<p align="left"><font size="2"></font></p>
<p align="left"><font size="2">GenTcpServer2 =
{'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},</font><font size="2">permanent,2000,worker,[generic_tcp_server]},</font></p>
<p align="left"><font size="2"></font></p>
<p><font size="2">{ok,{{one_for_one,0,1}, [GenTcpServer1,
GenTcpServer2]}}.</font></p></span></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2"><span>N</span>othing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned?</font></div>
<div><font size="2"></font> </div>
<div><font size="2">F<span>or some reason it is only
starting one when I look in appmon etc.</span></font></div>
<div><font size="2"><span></span></font> </div>
<div><font size="2"><span>Any
thoughts?</span></font></div>
<div><font size="2"><span></span></font> </div>
<div><font size="2"><span>Many
Thanks,</span></font></div>
<div><font size="2"><span>Dan</span></font></div>
<div><br></div>
<div><font size="2" face="Arial"></font> </div><pre>***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
<a href="http://www.rbs.com" target="_blank">www.rbs.com</a>
<a href="http://www.rbs.com/gbm" target="_blank">www.rbs.com/gbm</a>
<a href="http://www.rbsgc.com" target="_blank">www.rbsgc.com</a>
***********************************************************************************
</pre></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div>