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 
   */ 
Experience pair programming with AI  Get Codota for Java