Session (computer networking)

In computer science and networking, a session is a two-way link, a relatively high layer in the OSI stack enabling interactive information exchange between two or more communication devices or ends – be they computers, automated systems, or live active users (see login session). A session is established at a certain point in time, and then 'torn down' - brought to an end - at some later point. A session may involve more than one message in each direction. A session is typically stateful, meaning that at least one of the communicating parties needs to hold current state information to be able to communicate.

An established session is the basic requirement to perform a connection-oriented communication. A session also is the basic step to transmit in connectionless communication modes. However, any unidirectional transmission does not define a session.

Communication Transport may be implemented as part of protocols and services at the application layer, at the session layer or at the transport layer in the OSI model.

In the case of transport protocols that do not implement a formal session layer (e.g., UDP) or where sessions at the protocl level are too short-lived, sessions are maintained by a higher level program. For example, a HTTP exchange between a browser and a remote host that includes a HTTP cookie with a unique session ID may identify a state such as information about the user's preferences or authorization level.

Maintaining session continuity between HTTP requests requires a session ID. The session ID is embedded within the <A HREF> or <FORM> links of dynamic web pages so that it is passed back to the CGI. CGI then uses the session ID to ensure session continuity between transaction phases.