Trying to create an ssl socket and limit the setup connection time

RESOLVED INVALID

Status

JSS
Library
RESOLVED INVALID
17 years ago
16 years ago

People

(Reporter: Jamie Nicolson, Assigned: Jamie Nicolson)

Tracking

Details

(Assignee)

Description

17 years ago
****BUG IMPORTED FROM NETSCAPE INTERNAL BUG DATABASE***
I need to re-evaluate this to see whether it is still an issue.
**************************

This case stems from the customer's question:
In JSS, the SSLSocket class: how does one create an SSLSocket and limit
the time it takes to setup the connection? (Like in NSS where there is a
timeout parameter in PR_Connect). The customer tried the setSoTimeout method,
but it did not work.

Customer states:

I just realized after reading the JSS doc again that SSLSocket does NOT use
the setSoTimeout to limit the setup connection time but the SSLServerSocket
does use setSoTimeout to limit the time to accept a connection.

Note that NSS also provides a way to limit the connection setup time. It
would be nice to have that same capability in JSS.

I think both capabilities are important: to provide the client with the
ability to limit the connection setup time so client apps don't hang, as
well as to provide the server with the capability to limit the accept
connection time.

So instead of trying to use the setSoTimeout with an ServerSocket, I used it
with an SSLServerSocket but that does not seem to limit the accept
connection time! See the sample server code below: my server blocks at the
accept() but does NOT time out after the 2 seconds. It looks like a bug.
Here is my code sample to use to file a defect with Engineering:

// ---- Begin server code sample ----

SSLServerSocket l = null;
SSLSocket s = null;

try {

  // Limit accept connection time to 2 seconds.
  l.setSoTimeout(2000);

  System.out.println("Accept connection timeout is " + new
Integer(l.getSoTimeout()).toString());

  s = (SSLSocket)l.accept();
  s.forceHandshake();
}
catch (SocketException se) {
  throw (new SecurityException("Error accepting a connection from " +
s.getInetAddress.().getHostAddress()));
}

// ---- End server code sample ----
(Assignee)

Comment 1

17 years ago
Did I screw up the cut-and-paste, or did mozilla? I think I'll try that again.
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → INVALID

Comment 2

16 years ago
lovely summary :p
dupe of bug 106145
Summary: but it did not work.Customer states:I just realized after reading the JSS doc again that SSLSocket does NOT usethe setSoTimeout to limit the setup connection time but the SSLServerSocketdoes use setSoTimeout to limit the time to accept a connection… → Trying to create an ssl socket and limit the setup connection time
You need to log in before you can comment on or make changes to this bug.