title: Disconnect client socket in java
body: <p>I am developing a chat project to serve iOS, Android, WindowsPhone application,</p>
  
  <p>I got bit problem:
  How can server socket detect disconnected client???,</p>
  
  <p>Explain: </p>
  
  <ol>
  <li><p>when i used java console, i click X button of windows then server socket detected disconnected client and i remove it in user online list</p></li>
  <li><p>when i use client on cell phone application and i shutdown Wifi and 3G to disconnect server socket but server socket did not detect disconnected client.</p></li>
  </ol>
  
  <p>How to solve this problem??</p>
  
  <p>P/S: i can not use clientSocket.setSoTimeout() because client always connect to server socket, it only disconnect when network problem.</p>