hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bensonthomas <bensontho...@sbcglobal.net>
Subject To understand how timeout works for Apache HC 3.1
Date Wed, 31 Dec 2008 01:33:38 GMT

Hi,

    I am trying to figure out how httpclient-timeout works? This is the
snippet of code that I am planning to put. Indicated below?

      (a) What is the uses for these code snippets and there differences?
      
          (i) connManagerParams.setSoTimeout(timeout);
               (ii) connManagerParams.setConnectionTimeout(timeout); 
               (iii) cliParams.setConnectionManagerTimeout(timeout); 
               (iv) cliParams.setParameter("http.socket.timeout", new
Integer(1000)); 

      (b) How can I know that this will work?

I would love to know its impacts. Although I seem to have figured out
section (i) and this is a connection socket timeout.

Thanks much.



        PostMethod postMethod = new PostMethod(nUrl.toString());
        try
        { 
             int timeout = 1000;
            HttpConnectionManager connManager = new
SimpleHttpConnectionManager();
            
            HttpConnectionManagerParams connManagerParams = new
HttpConnectionManagerParams();

            //Execute Post
            connManagerParams.setSoTimeout(timeout);
            connManagerParams.setConnectionTimeout(timeout); 
            connManager.setParams(connManagerParams);
            cliParams.setConnectionManagerTimeout(timeout); 
            
            cliParams.setParameter("http.protocol.version",
HttpVersion.HTTP_1_1); 
            cliParams.setParameter("http.socket.timeout", new
Integer(1000)); 
            cliParams.setParameter("http.protocol.content-charset",
"UTF-8"); 
            
            HttpClient httpClient = new HttpClient(cliParams, connManager); 
            HttpClient httpClient = new HttpClient(connManager); //NN

-- 
View this message in context: http://www.nabble.com/To-understand-how-timeout-works-for-Apache-HC-3.1-tp21225975p21225975.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message