Reusing Sessions
Client applications usually make many connections to the same server. For example, standard Web browsers might connect to a server to download the main Web page, and then connect several times simultaneously to download the images on the page. For each connection, the SSL/TLS protocol requires that the client and server execute the SSL Handshake protocol, which includes exchanging keys and certificates, and generating session keys.
If your application needs many SSL/TLS connections to the same server within a short time, the SSL/TLS protocol allows you to reuse a previous SSL/TLS session. A session is defined by connection parameters, including protocols and keys.
To attempt to reuse a session:
1. Extract the session from a connected RWSecureSocket or RWSecureSocketPortal with getSession().
This function returns an RWSecureSocketSession object that your application can store for later use (see RWSecureSocketSession).
2. When your application attempts to reuse the session, it passes the RWSecureSocketSession object to the RWSecureSocket or RWSecureSocketPortal constructor or connect().
The server can refuse to reuse the session if:
*the session is too old
*the server’s session cache filled up quickly and the session was removed
If your session cannot be reused, the protocol automatically renegotiates a new session without any intervention from your application. For more information, see the example in examples\secsock\manual\SessionReuseExample.cpp.