The following is the code segment where the exception is occuring....
run()
{
while (serverUp)
{
.....
....
try{
HttpsURLConnection vbg =
(HttpsURLConnection)url.openConnection();
vbg.setDoInput(true);
vbg.setDoOutput(true);
vbg.setUseCaches(false);
vbg.setAllowUserInteraction(false);
vbg.setFollowRedirects(false);
vbg.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// exception occurs in vbg.getOutputStream()
DataOutputStream post = new
DataOutputStream(vbg.getOutputStream());
....
....
sleep(5*60*1000); // 5 minutes in milliseconds
}
catch (exception e)
{
e.printStackTrce();
}
}
}
Any help is very much appreciated.
-Shan
java.net.SocketException: Socket closed
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
at java.io.OutputStream.write(OutputStream.java:65)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.l([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.<init>([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.<init>([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connect([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getOutputStream([DashoPro-V1.2-120198])
at com.fbf.sysmgt.nanny.LoginThread.login(LoginThread.java:253)
at com.fbf.sysmgt.nanny.LoginThread.run(LoginThread.java:116)
at java.lang.Thread.run(Thread.java:479)
This is quite normal (even without SSL).
There's no way for handling that, except reestablishing (reopening) the connection
in the catch block. The problem ist to hold the State of the client (reauthorization,etc.).
About Socket - recycling I can't tell you something. For clients,
that doesn't make some sense, I suppose.