hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tompra <mail...@tomasparal.cz>
Subject HttpClient 4.0. SocketTimeoutException and RST signal problem
Date Thu, 15 Oct 2009 16:16:29 GMT

Hi,

I have problem with RST signal from instance of HttpClient that invokes a
SocketTimeoutException: Read Timeout.

In an attachement there is an image of network communication between my
client and server, where client invokes RST. 

http://www.nabble.com/file/p25911599/SocketTimeoutException1.jpg
SocketTimeoutException1.jpg 

My client makes a lot of correct requests but sometimes there is a problem
with RST. Sometimes comes many SocketTimeoutException in the same time and
than we haven't problem several next hours. Can the server be a reason of
this problem? 

The exception is:

class java.net.SocketTimeoutException:
 Read timed out
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:130)
org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:127)
org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:233)
org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:210)
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:271)
org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:227)
org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:229)
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:292)
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:126)
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)

My code is:

HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, 30000);
HttpConnectionParams.setSoTimeout(params, 30000);
	    	
HttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler(3,
true);

DefaultHttpClient httpClient = new DefaultHttpClient(params);
httpClient.setHttpRequestRetryHandler(retryHandler);
  	
HttpGet httpGet = new HttpGet(URIUtil.encodeQuery(targetUrl));
        
HttpResponse response = httpClient.execute(httpGet);

HttpEntity entity = response.getEntity();
if (entity == null) {
            throw new ....
}

String content = EntityUtils.toString(entity);

Can you help me and show me the way? Thank you.

Best regards,

Tom
-- 
View this message in context: http://www.nabble.com/HttpClient-4.0.-SocketTimeoutException-and-RST-signal-problem-tp25911599p25911599.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