This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes can't find an errors but always in connectException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "can Watch "can New topic
Author

can't find an errors but always in connectException

Abhijith Sugunan
Greenhorn

Joined: Aug 04, 2012
Posts: 10
/*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);

}

}



}
 
Have you checked out Aspose?
 
subject: can't find an errors but always in connectException
 
It's not a secret anymore!