Article View: aus.computers.java
Article #1011Re: Connection Refused??
From: iccucima
Date: Fri, 07 Jan 2000 00:00
Date: Fri, 07 Jan 2000 00:00
60 lines
2567 bytes
2567 bytes
Hi,
(perhaps you can help me.)
I'm a beginner and have a similar problem. When I try to open a
connection from the company intranet, I have a FileNotFoundException;
when I use
java -Dhttp.proxyHost=proxyhost
[-Dhttp.proxyPort=portNumber] download_url
the program simply terminates immediately.
Note. I can use a browser, but not TeleportPro (??).
This is the code:
import java.net.*;
import java.io.*;
public class download_url {
public static void main(String[] args) throws Exception {
String base = new String( args[0] ), inputLine;
URL yahoo = new URL( base );
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahoo.openStream()));
while ((inputLine = in.readLine()) != null)
System.out.println( inputLine );
in.close();
}
}
In article <3873f65d_2@news.ausmail.com>,
"Tony F. White" <tony@worldlingo.com> wrote:
> Does anyone have any idea why the following code would work for
> http://localhost/jserv/index.html
> but not
> http://www.java.sun.com/index.html
>
> URL inputUrl = new URL(input.trim()); /*where input is a
string
> containing a http: address */
> InputStream inputStream = inputUrl.openStream();
>
> the code throws the following exception:
> java.net.ConnectException: Connection refused: no further
> information
>
> I have tried using the longer version of openstream and it throws the
> exception when it trys to get the inputstream
> (Note the code is part of a servlet)
>
>
Thanks in advance,
Andrea
Sent via Deja.com http://www.deja.com/
Before you buy.
Technical Details
Message-ID:
<854bno$cih$1@nnrp1.deja.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3873f65d_2@news.ausmail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d6b,3b83b41b4e779962 X-Google-Attributes: gid111d6b,public X-Google-Thread: f5d71,3b83b41b4e779962 X-Google-Attributes: gidf5d71,public X-Google-Thread: 10d6db,b2135abe5ab317a1 X-Google-Attributes: gid10d6db,public X-Google-Thread: 10a146,b2135abe5ab317a1 X-Google-Attributes: gid10a146,public From: iccucima@my-deja.com Subject: Re: Connection Refused?? Date: 2000/01/07 Message-ID: <854bno$cih$1@nnrp1.deja.com> X-Deja-AN: 569307560 References: <3873f65d_2@news.ausmail.com> X-Http-Proxy: 1.0 S_WEBISDN, 1.0 x30.deja.com:80 (Squid/1.1.22) for client 194.185.136.171 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Jan 07 09:30:31 2000 GMT X-MyDeja-Info: XMYDJUIDiccucima Newsgroups: aus.computers.java,comp.lang.java,comp.lang.java.misc,comp.lang.java.programmer X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)