Topic Path: Symbol Reference > Classes > TIdHTTPDefaultSessionList Class > TIdHTTPDefaultSessionList Methods > GetSession Method
TIdHTTPDefaultSessionList.GetSession Method

Retrieves a persistent HTTP session having the specified ID and remote IP address.

function GetSession(
    const SessionID: string; 
    const RemoteIP: string
): TIdHTTPSession; override;
Session identifier to be located.
Optional remote IP address for the session. 

TIdHTTPSession - Persistent session retrieved from the container.

GetSession is an overridden TIdHTTPSession function used to retrieve a persistent HTTP session having the remote IP address and session identifier specified in SessionID and RemoteIP. 

GetSession ensures 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 identifier and remote IP address, the session is time-stamped for last access to prevent purging as a stale session in PurgeStaleSessions

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.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.