Internet Direct (Indy) Version 9.0.1 Beta
TIdHTTPDefaultSessionList.GetSession
Retrieves a persistent HTTP session having the specified ID and remote IP address.

function GetSession(const SessionID: string; const RemoteIP: string): TIdHTTPSession; override;
Parameters
const SessionID: string
Session identifier to be located.

const RemoteIP: string
Optional remote IP address for the session.

Returns
TIdHTTPSession - Persisten session retrieved from the container.

Description
GetSession is a TIdHTTPSession function used to retrive a persistent HTTP session having the remote IP address and session identifier specified in SessionID and RemoteIP. GetSession insures that the internal thread list is locked prior to accessing sessions in the container.

GetSession will iteratively search through all sessions in the container until a session is located with the specified SessionID and RemoteIP. If RemoteIP contains an empty string, the first session with the same session identifier is used.

When a session is located for the session identifer and remote IP address, the session is timestamped for last access to prevent purging as a stale session.

The return value for GetSession can contain Nil when a session cannot be located with the specified values.

GetSession will unlock the internal thread list prior to exiting from the method.