<div dir="ltr">Hello List ,<div>Hope everyone is cool.</div><div><br></div><div>i noticed a few patterns in some tutorials i was going through and wanted some insight .</div><div>How many application behaviors can you attach to a single module and how does this affect  the behavior of the module . </div><div><br></div><div>i saw these examples </div><div><pre><font color="#000000">-module(a).
-behaviour(application).
-export([start/2, stop/1, start_pool/3)

start(normal, _Args) ->
    ppool_supersup:start_link().</font></pre><pre><font color="#000000">.....</font></pre><pre>%%%%and b below </pre></div><div><pre style="color:rgb(0,0,0)"><b>-</b><span class="">module</span>(<span class="">b</span>).
-<span class="">behaviour</span>(<span class="">application</span>).
-<span class="">behaviour</span>(<span class="">supervisor</span>).

-<span class="">export</span>([<span class="">start</span>/<span class="">2</span>, <span class="">stop</span>/<span class="">1</span>]).
-<span class="">export</span>([<span class="">init</span>/<span class="">1</span>]).

<span class="">start</span>() <span class="">-></span>
<span class="">application</span>:<span class="">start</span>(<span class="">?</span><span class="">MODULE</span>).</pre><pre style="color:rgb(0,0,0)">.......</pre><pre style="color:rgb(0,0,0)">in module a</pre><pre style="color:rgb(0,0,0)"> i know the start function will call the top level supervisor </pre><pre style="color:rgb(0,0,0)">and the top level supervisor will start itself and possibly children etc...</pre><pre style="color:rgb(0,0,0)">in module b </pre><pre style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif">i know the  start function will be run and run application:start(?module) . </span><br></pre><pre><font color="#000000" face="arial, sans-serif">what happens after that  because the function seems to be calling itself which is causing me to scratch my head .</font></pre><pre><font color="#000000" face="arial, sans-serif">what happens to the supervisor behavior  also .</font></pre><pre style="color:rgb(0,0,0)">can you put different behaviors into a single module and evoke them and make that one module have all the behaviours eg. can a single module be a gen_server,supervisor  or are there some special instances where this is allowed .(genserver and supervisor both have one init function so i was beginning to doubt this but what if your behaviors have different names):</pre><pre style="color:rgb(0,0,0)">i.e. create your own custom behaviours</pre><pre style="color:rgb(0,0,0)">an unrelated question<span style="font-family:arial,sans-serif"> </span></pre><pre style="color:rgb(0,0,0)">does a socket closing  send a  message to the controlling process immediately . i get the <span style="font-family:arial,sans-serif">{tcp_closed, _Socket} message only when i am sending a message to a closed socket . it there a way the controlling process is immediately notified of a closed socket and not nessaringly when you tring sending a message to it </span></pre><pre style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif"><br></span></pre><pre style="color:rgb(0,0,0)"><span style="font-family:arial,sans-serif">thanks !!!</span></pre><div><div style><br></div><div><br></div></div><pre style="color:rgb(0,0,0)"><br></pre><pre style="color:rgb(0,0,0)"><br></pre><pre style="color:rgb(0,0,0)"><br></pre></div></div>