You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Allen, Michael B (RSCH)" <Mi...@ml.com> on 2002/01/31 04:50:12 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>