Hello Graeme,

Graeme Rouse <[EMAIL PROTECTED]> schrieb am 07.11.2006 um 15:33:

[...]
> 
> I have been trying to determine how to correctly set the timeout  
> parameters in order to limit the connection time and force the code  
> below to complete within a maximum amount of time.
[...]
> 
> my code:
> 
> final int SOCKET_TIMEOUT = 1000;
> final int CONNECTION_TIMEOUT = 1000;
> long start = System.currentTimeMillis();
> 
> HttpClient httpclient = new HttpClient();
> GetMethod httpget = new GetMethod( UNREACHABLE_HOST );
> httpget.getParams().setSoTimeout( SOCKET_TIMEOUT );
> httpget.getParams().setParameter( "http.connection.timeout",  
> CONNECTION_TIMEOUT );

Try to set the timeout on the connection manager:

httpclient.getHttpConnectionManager().getParams()
  .setSoTimeout(CONNECTION_TIMEOUT);

or 

MultiThreadedHttpConnectionManager connectionManager 
  = new MultiThreadedHttpConnectionManager();

connectionManager.getParams().setConnectionTimeout(CONNECTION_TIMEOUT);

HttpClient httpclient = new HttpClient(connectionManager);


Regards,
Olaf


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to