title: Is java.net.Socket.setSoTimeout reliable?
body: <p>From the JavaDoc for <a href="http://java.sun.com/javase/6/docs/api/java/net/Socket.html#setSoTimeout%28int%29" rel="nofollow noreferrer">setSoTimeout</a></p>
  
  <blockquote>
    <p>Enable/disable SO_TIMEOUT with the
    specified timeout, in milliseconds.
    With this option set to a non-zero
    timeout, a read() call on the
    InputStream associated with this
    Socket will block for only this amount
    of time. If the timeout expires, a
    java.net.SocketTimeoutException is
    raised, though the Socket is still
    valid. The option must be enabled
    prior to entering the blocking
    operation to have effect. The timeout
    must be > 0. A timeout of zero is
    interpreted as an infinite timeout.</p>
  </blockquote>
  
  <p>From the variety of posts on the Internet I have read that SO_TIMEOUT is rather unreliable when using Socket C API ( e.g. <a href="http://www.developerweb.net/forum/showthread.php?t=4526" rel="nofollow noreferrer">here</a> ).</p>
  
  <p>Hence the question, is it reliable to use <code>setSoTimeout</code> to check for run-away sessions?</p>
  
  <p>If not, what techniques can you recommend to put a time limit on socket sessions?</p>