Code example for Socket

Methods: setSoLingersetSoTimeoutsetTcpNoDelay

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 
   */