Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SSL Socket error - java.net.SocketException: Socket closed

1,270 views
Skip to first unread message

shan

unread,
Sep 12, 2001, 11:43:38 PM9/12/01
to
My Java client program connects to a server (running IPlanet) and
performs login/logout every 5 minutes. When the webserver is restarted
I get the following exception.
The program uses SSL and com.sun.ssl.* is the SSL provider.
IS there anything I should do to re-initialize the sockets/etc.
When the client program is stopped and started again everything is
fine...

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)

Martin Erren

unread,
Sep 13, 2001, 7:56:49 AM9/13/01
to
> My Java client program connects to a server (running IPlanet) and
> performs login/logout every 5 minutes. When the webserver is restarted
> I get the following exception.
> The program uses SSL and com.sun.ssl.* is the SSL provider.
> IS there anything I should do to re-initialize the sockets/etc.
> When the client program is stopped and started again everything is
> fine...

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.

0 new messages