Oleg,
I appreciate your fast reply. Thank you!
But I can't seem to figure out what the problem is. Do I miss
something in the section on timeouts?
/regards, Håkan
19 jan 2009 kl. 15.14 skrev Oleg Kalnichevski:
On Mon, 2009-01-19 at 11:39 +0100, hakan.jacobsson wrote:
Hi,
I'm using HttpClient 3.1 to connect to a server.
I've set both the connection timeout and the socket timeout.
I set the connection timeout in the HttpConnectionManager (later set
in HttpClient) like this:
------------
MultiThreadedHttpConnectionManager cm = new
MultiThreadedHttpConnectionManager();
//connection timeout - same value as for socket timeout
(set in
the PostMethod - see below))
cm.getParams().setConnectionTimeout(Integer.parseInt(getProperty
(MADS_AD_TIMEOUT)));
//set HttpConnectionManager in HttpClient
madsClient.setHttpConnectionManager(cm);
------------
I set the sockettimeout in the PostMethod class like this:
------------
//retry and socket timeout settings (result = an
instance of
PostMethod)
result.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(1, false));
//socket timeout (connection timeout already set in
HttpClient)
result.getParams().setSoTimeout(Integer.parseInt(getProperty
(MADS_AD_TIMEOUT)));
-------------
At times (when the server we connect to is slow on response?) the
requests still wait for a much longer time than the timeout we use
(500 ms).
A SocketTimeout/ConnectionTimeout-exception is thrown, but this might
take a very long time (48 seconds is a recent example). We measure
the time in
our code.
Any idea what might cause this problem?
Timeouts work. Please see the description of the socket timeout
(SO_TIMEOUT) for details as to what exactly this value represents.
Oleg
/best regards, Håkan Jacobsson, System developer in Stockholm,
Sweden.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]