code: public synchronized void setSoTimeout(int timeout) throws SocketException {
          if (isClosed())
              throw new SocketException("Socket is closed");
          getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
      }
docs: Enable/disable SO_TIMEOUT with the specified timeout, in
  milliseconds.  With this option set to a non-zero timeout,
  a call to accept() for this ServerSocket
  will block for only this amount of time.  If the timeout expires,
  a <B>java.net.SocketTimeoutException</B> is raised, though the
  ServerSocket is still valid.  The option <B>must</B> 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.
  @param timeout the specified timeout, in milliseconds
  @exception SocketException if there is an error in
  the underlying protocol, such as a TCP error.
  @since   JDK1.1
  @see #getSoTimeout()