Am getting UnKnownHostException everytime whenever i try to get a URLConnection for many valid urls.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mahender_Ginuga
Posted On:   Tuesday, December 18, 2001 04:09 AM

i am trying to get a URLConnection from a server with many valid urls, but i always got UnKnownException. why i am getting like that, is there any mistake in my program? please answer to my question immediately. ( code is : URL u = new URL("http://www.amnesty.org/"); HttpURLConnection huc = (HttpURLConnection) u.openConnection(); huc.setRequestMethod("PUT"); huc.connect(); OutputStream os = huc.getOutputStream(); int code = huc.getResponseCode(); if ((code >= 200) && (code < 300)) { // put the data... System.out.println("connected"); } huc.disconnect(); os.close(); )    More>>

i am trying to get a URLConnection from a server with many valid urls, but i always got UnKnownException.
why i am getting like that, is there any mistake in my program?
please answer to my question immediately.
( code is :
URL u = new URL("http://www.amnesty.org/");
HttpURLConnection huc = (HttpURLConnection) u.openConnection();
huc.setRequestMethod("PUT");
huc.connect();
OutputStream os = huc.getOutputStream();
int code = huc.getResponseCode();
if ((code >= 200) && (code < 300)) {
// put the data...
System.out.println("connected");
}
huc.disconnect();
os.close();

)

   <<Less
About | Sitemap | Contact