In the Open Systems Interconnection (OSI) communications model, the session layer resides at Layer 5 and manages the setup and teardown of the association between two communicating endpoints. The communication between the two endpoints is known as the connection. A connection is established and maintained while the two endpoint applications are communicating back and forth in a conversation, or session, of some duration. Lower-level protocols are responsible for the actual transmission data. However, this is typically done in short-lived transmissions. The session layer builds a transmission bridge to provide more efficient long-term transport, as well as a way to better organize simultaneous communication of multiple network applications.
When the communication between network applications is complete, session layer services terminate the connection. Some connections last only long enough to send a message in one direction. This is known as a simplex transmission. Another popular transmission mode is half-duplex. Here, the communication is bidirectional, but occurring in a single direction at a time. Finally, full-duplex connections enable bidirectional communication that occurs simultaneously.
The session layer is also responsible for masking potential transport layer failures from upper-layer protocols. This includes mechanisms to handle errors in endpoint transmit/receive synchronization, transmission checkpoints and connection recovery. Additionally, sessions help to group multiple transport streams that belong to a specific application. Different data streams can then be combined and synchronized at the endpoint destination prior to sending the streams received up the stack to the presentation layer.
Examples of session layer protocols include X.225, AppleTalk and Zone Information Protocol (ZIP). Technically speaking, TCP/IP does not use an exclusive session layer. Instead, session and presentation services are handled at the application layer within the TCP/IP model.
Functions of the session layer
- sets up, tears down and manages the communication between two application endpoints;
- builds semipermanent transport bridges for more efficiency and data stream organization;
- masks communication failures from upper-layer services in the OSI model; and
- manages data synchronization of multiple session streams.