title: JAVA : Handling socket disconnection
body: <ol>
  <li>Two computers are connected by socket connection. If the server/client closes the connection
  from their end(i.e closes the <code>InputStream</code>, <code>OutputStream</code> and <code>Socket</code>) then how can I inform
  the other end about the disconnection? There is one way I know of - trying to read from the <code>InputStream</code>,
  which throws an <code>IOException</code> if connection is closed, but is there any other way to detect this?</li>
  <li>Another question, I looked the problem up on the internet and saw <code>inputStream.available()</code>
  does not solve this problem. Why is that?</li>
  </ol>
  
  <p><strong>Additional Information :</strong> I'm asking for another way because my project becomes tough to handle if I have to try to read from the
  <code>InputStrem</code> to detect a disconnection.</p>