Hi,

Song Chang wrote:
> Hi, I tried the following program. Everytime I get the
> following exception when hitting www.apache.org.
> However if I change to www.sun.com, I get the
> response. It is really weird it works on some sites,
> but not others. For example, www.ibm.com get the same
> error. While www.nyu.edu works. I am totally confused
> with this. I tried both java 1.4.2 and java 1.5. Your
> help is really appreciated.
> 
> Fatal transport error: Connection reset
> java.net.SocketException: Connection reset
>         at java.net.SocketInputStream.read(Unknown

>     // Provide custom retry handler is necessary
>    
> method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
> 
>               new DefaultHttpMethodRetryHandler(3, false));

Why do you need a retry handler? Have you tried without?
I suspect some problem related to connection re-use, and
since you're sending only one request that probably has
to do with retry handling.

Which version of HttpClient are you using? Please post
wire logs for a host that is working and one that fails:
http://jakarta.apache.org/commons/httpclient/logging.html

cheers,
  Roland


> 
>     try {
>       // Execute the method.
>       int statusCode = client.executeMethod(method);
> 
>       if (statusCode != HttpStatus.SC_OK) {
>         System.err.println("Method failed: " +
> method.getStatusLine());
>       }
> 
>       // Read the response body.
>       byte[] responseBody = method.getResponseBody();
> 
>       // Deal with the response.
>       // Use caution: ensure correct character
> encoding and is not binary data
>       System.out.println(new String(responseBody));
> 
>     } catch (HttpException e) {
>       System.err.println("Fatal protocol violation: "
> + e.getMessage());
>       e.printStackTrace();
>     } catch (IOException e) {
>       System.err.println("Fatal transport error: " +
> e.getMessage());
>       e.printStackTrace();
>     } finally {
>       // Release the connection.
>       method.releaseConnection();
>     }  
>   }
> }
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to