Code example for Socket

Methods: setSoLinger, setSoTimeout, setTcpNoDelay

0
     */ 
    protected void prepareSocket( 
            final Socket sock,
            final HttpContext context,
            final HttpParams params) throws IOException {
        sock.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
        sock.setSoTimeout(HttpConnectionParams.getSoTimeout(params));
 
        int linger = HttpConnectionParams.getLinger(params);
        if (linger >= 0) {
            sock.setSoLinger(linger > 0, linger);
        } 
    } 
 
    /** 
     * Resolves the given host name to an array of corresponding IP addresses, based on the 
     * configured name service on the system. 
     * 
     * @param host host name to resolve 
     * @return array of IP addresses 
     * @exception  UnknownHostException  if no IP address for the host could be determined.