hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugeny N Dzhurinsky <b...@redwerk.com>
Subject Re: socket errors (connection reset, read timed out)
Date Fri, 10 Nov 2006 15:45:37 GMT
On Fri, Nov 10, 2006 at 04:25:29PM +0200, Eugeny N Dzhurinsky wrote:
> On Fri, Nov 10, 2006 at 12:49:33PM +0100, Roland Weber wrote:
> > Hello Eugene,
> > 
> > > As far as I can see this exception handler can handle only exceptions 
> > derived
> > > from IOEXception - but not java.net.SocketException etc?
> > SocketException extends IOException.
> > What would be etc?
> 
> Really, I missed this point, thanks ;)
> 
> > > Just to make it clear - should I set ReflectionSocketFactory.java to
> > > HttpClient, or I need to write my own implementation?
> > 
> > You should write your own. ReflectionSocketFactory is a very
> > complicated way to call JDK 1.4 specific methods while still
> > compiling against a 1.3 API. But have a look at the comments there.
> 
> Okay. I wrote this implementation:

Found few issues after copy/pasting

>     public Socket createSocket(String host, int port) throws IOException,
>             UnknownHostException {
>         Socket socket = null;
>         int localTries = maxTries;
>         SocketException lastException = null;
>         while (--localTries > 0)
>             try {
>                 socket = new Socket(host, port);
>                 maxTries = 0;

localTries = 0;

>     /**
>      *@see org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket(java.lang.String,
int, java.net.InetAddress, int)
>      */
>     public Socket createSocket(String host, int port, InetAddress localAddress,
>             int localPort) throws IOException, UnknownHostException {
>         Socket socket = null;
>         int localTries = maxTries;
>         SocketException lastException = null;
>         while (--localTries > 0)
>             try {
>                 socket = new Socket(host, port, localAddress, localPort);
>                 maxTries = 0;

localTries=0;

-- 
Eugene N Dzhurinsky

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message