[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    RE: httpclient hangs indefinately
From:       otisg () ivillage ! com
Date:       2002-01-31 19:43:40
[Download RAW message or body]

Yes, that is some OS-dependent timeout value.  3 min. and 15 seconds or so on Linux, some other timeout value on Winblows, etc.

Otis


On Thu, 31 January 2002, JEvans@Cyveillance.com wrote:

> 
> Incidentally, it doesn't actually hang indefinately, for me it looks like it
> times out after about 3 minutes and 12 seconds.  
> 
> -----Original Message-----
> From: JEvans@cyveillance.com [mailto:JEvans@cyveillance.com]
> Sent: Thursday, January 31, 2002 1:24 PM
> To: commons-dev@jakarta.apache.org
> Subject: RE: httpclient hangs indefinately
> 
> 
> Well, since the con.open() method creates a new Socket object, it is subject
> to the behavior of the Socket class.  Unfortunately, at least as of 1.3,
> attempting to create a new Socket to a host/port combo that does not answer
> blocks indefinately (or at least for a very long time), this can't be
> avoided directly.  (It would be really nice if the JDK provided a Socket
> constructor that took a timeout value to pass to the underlying OS).  The
> three ways I can think of to avoid it off hand are:
> 
>     1. Implement a timeout mechanism outside of HttpClient with a
> seperate thread that interrupts the connection attempts.
>     2. Implement a Socket object in the HttpClient framework that uses
> this same sort of mechanism but hides the details behind the API
>     3. Use the 1.4 JDK and upgrade everything to use the new channels
> API in non-blocking mode.
> 
> I wish there were a cleaner way.  If anyone knows of one I'd love to hear
> it.
> 
> -
> John
> 
> -----Original Message-----
> From: Allen, Michael B (RSCH) [mailto:Michael_B_Allen@ml.com]
> Sent: Wednesday, January 30, 2002 10:50 PM
> To: 'commons-dev@jakarta.apache.org'
> Subject: httpclient hangs indefinately
> 
> 
> If I just use a simple test program like below and try to connect to certain
> IP addresses that
> are routable but don't have anything listing at the other end (returns
> nothing, dead air), the
> client hangs indefinately. Can anyone think of a solution to this problem?
> 
> Thanks,
> Mike
> 
> import org.apache.commons.httpclient.*;
> 
> public class Test {
> 
>         public static void main(String[] argv) throws Exception {
>                 HttpConnection con = new HttpConnection( argv[0],
> Integer.parseInt( argv[1] ));
>                 con.open();
>                 con.printLine( "GET /index.html HTTP/1.0" );
>                 con.printLine();
>                 String s;
>                 while(( s = con.readLine() ) != null ) {
>                         System.out.println( s );
>                 }
>         }
> }
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>

_________________________________________________________________
iVillage.com: Solutions for Your Life 
Check out the most exciting women's community on the Web   
http://www.ivillage.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic