Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't find an errors but always in connectException

 
Abhijith Sugunan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*ConnectException : Address is invalid on the local machine or port is not valid on the remote machine .And i am doing it in my wampserver .i get this program correct before but now it's result in exception */

import java.net.*;
import java.io.*;

class nightWork {


public static void main(String [] args) throws Exception{

int res;
URL url = new URL("http://localhost/res.php");"
URLConnection con = url.openConnection();

try {

InputStream in = con.getInputStream();
OutputStream out = con.getOutputStream();

while(((res=in.read()) !=-1)) {

System.out.println((char) res);

}

}catch(IOException e) {

System.out.println(e);

}

}



}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic