Detecting loss of connection between server and client
<p>How will the server know of client connection loss? does this trigger an event? is this possible to store code (server side) so that it can execute before the connection loss happen?</p>

<p>This connection loss can happen if:</p>

<ul>
<li>being idle for too long. </li>
<li>client side terminated.</li>
</ul>

<p>etc.</p>

<p>This i am asking in particular to Jsp and php.</p>
