You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by bensonthomas <be...@sbcglobal.net> on 2008/12/31 02:33:38 UTC

To understand how timeout works for Apache HC 3.1

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