Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

urlConnection

Status
Not open for further replies.

berman

Programmer
Dec 7, 2000
11
IE
hi.

i have a program working on windows but when i copy it over to unix and compile it there and run it it gives me this error:

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:282)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:124)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:111)
at java.net.Socket.<init>(Socket.java:221)
at java.net.Socket.<init>(Socket.java:89)
at sun.net.NetworkClient.doConnect(NetworkClient.java:54)
at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at lookup.main(lookup.java:30)


the unix machine is connected to the net !
its just a simple program that creates a URL object.
gets a URLConnection from this. gets an inputstream
from and an output stream. and runs
the cgi program on dictionary.com for looking up words.

anyone any idea where the error is coming from ?

in case im being vague ... heres a smidgeon of my
code.

URL url = new URL(&quot;URLConnection connection = url.openConnection();
connection.setDoOutput(true);

PrintWriter out = new PrintWriter(connection.getOutputStream());
out.println(&quot;term=&quot; + stringToLookup);
out.close();

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));

ant help greatly appreciated ...

david
 
David,

Based on the error message it appears that the server is denying your connection request. It does not appear to be a problem with the requesting machine.

Of course the error message could be misleading.

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top