Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: All about session

by gellyfish (Monsignor)
on Sep 14, 2006 at 08:42 UTC ( [id://572891]=note: print w/replies, xml ) Need Help??


in reply to All about session

I am going to guess you are talking about a "Session" in some kind of web application, but as you don't make this clear I could be totally wrong and you could be talking about LDAP, SNMP or something else where people occasionally refer to "sessions" in some context.

As you almost certainly know HTTP is basically a stateless protocol, that is to say that basically the server considers any request and its associated response to be completely unrelated to any other (HTTP/1.1 chunking and so forth notwithstanding,) so any application that extends beyond a single request and response sequence will need to make it's own arrangements to manage the relationship between the requests and persist its data after it has sent the response, this is known as "Session Management". Basically the application has to identify a request for a known user or client (for example) and either retrieve the stored application data or create a new unique identifier for the "Session" by which subsequently stored data can stored and retrieved. Typically this unique identifier will be passed between the application and the client in a Cookie or part of the URL, but I'm sure other mechanisms exist.

Some web applications frameworks such as ASP or JSP can automatically create the "Session" and automatically store and retrieve the associated data between requests, it is of course up to the application to decide what data is to be stored in the Session. Perl on the other hand, being a general purpose programming language and not a web application framework, needs to have some explicit mechanism to do this; normally one would use a module such as Apache::Session or CGI::Session to manage this, but there is no compulsion to do this.

A "Session" will generally be used by a web application to store information that needs to persisted across multiple HTTP requests from the client, such as the contents of a shopping cart, the data from a multipage form, or data extracted from a database at login that the application will need to reference frequently. This information will be stored within the running program in whatever manner the session management library requires (say for instance a perl hash) and the session managent library should ensure that when the HTTP request has been handled this data will be written to some persistent storage for retrieval at the time of the next associated request of the client. Usually the persistent storage will be in some database or file, but shared memory, message queues and other mechanisms can be used.

So "saving a session" is simply the act of storing the data that a web application will need in subsequent requests in a manner that will allow it to be retrieved into the application when there is a request from the client for which that data was stored for.

/J\

Replies are listed 'Best First'.
Re^2: All about session
by thil (Sexton) on Sep 14, 2006 at 10:24 UTC
    Thanks. Yeah.. it's a priliminary question that I have asked(being a newbie)...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://572891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-26 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found