Code example for Socket

Methods: setSoLinger, setSoTimeout, setTcpNoDelay

0
 
  /** 
   * Initializes the socket object 
   */ 
  private void initSocket() { 
    socket_ = new Socket(); 
    try { 
      socket_.setSoLinger(false, 0); 
      socket_.setTcpNoDelay(true); 
      socket_.setSoTimeout(timeout_); 
    } catch (SocketException sx) { 
      LOGGER.error("Could not configure socket.", sx); 
    } 
  } 
 
  /** 
   * Sets the socket timeout 
   * 
   * @param timeout Milliseconds timeout 
   */ 
  public void setTimeout(int timeout) {