This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes java.net.SocketException (while getting data from an url) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java.net.SocketException (while getting data from an url)" Watch "java.net.SocketException (while getting data from an url)" New topic
Author

java.net.SocketException (while getting data from an url)

subodh varshney
Greenhorn

Joined: Aug 01, 2005
Posts: 11
Hi All,
i m using following code for url connection, and getting error.
Please help me.

URL url = new URL(urlString);
HttpsURLConnection conn=(HttpsURLConnection)url.openConnection();
conn.setHostnameVerifier(new MyHostnameVerifier());
conn.setAllowUserInteraction(true);
conn.setDoOutput(false);
conn.setRequestMethod("GET");
conn.getContent();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String str="";
String str1="";
while ((str = in.readLine()) != null) {
if(!str.equalsIgnoreCase(""))
System.out.println("STR:::::"+str);
str1+=str+"\n";
}
in.close();

<-------------------I am getting following error ---------------->

java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:802)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:702)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:583)
at java.net.URLConnection.getContent(URLConnection.java:582)Unable to send the message
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.net.SocketException (while getting data from an url)
 
Similar Threads
SocketException in WSAD
Request web Page on Glassfish server using java code
NoClassDefFoundError
HTTP(S) Timeout while invoking WebService over HTTPS.
Communicating with HTTPS server with Client Authentication