Ping Works, Page Won't Load: Ports, TCP and UDP | OSI Layer 4
Numbered doors, the truck that calls ahead and the bullhorn that doesn't.
A branch-office call rings, connects, both sides hear each other perfectly — and at thirty-two seconds it hangs up. Every call. Every time. The road is fine, the address is fine, the doors are open: every delivery worked, and the conversation broke. In this episode Professor Flows explains the Session layer using Byte City's delivery window: open, maintain, close.
A user in the branch office calls head office. It rings. They pick up. Both sides can hear each other perfectly. And at thirty-two seconds, the call hangs up. Every call. Every time.
The road is fine. The address is fine. The doors are open: the voice was getting through. Every delivery worked. It's the conversation that broke. That is Layer 5 of the OSI model: the Session layer.

The Layer 4 lesson got one delivery to one door. But a conversation isn't one delivery. It's dozens, sometimes thousands, and somebody has to keep track of the whole thing.
In the OSI model lesson, we called that job the delivery window. Before two houses start trading, they open a window between them: who are you, what are we doing, what rules are we following?
While the window is open, deliveries go back and forth: cube trucks, bullhorn shouts, whichever fits. When the houses are finished, the window is closed properly, so neither side is left waiting for something that will never come.
Open. Maintain. Close. That is the whole job of Layer 5.

Don't confuse the window with the truck's call-ahead from the Layer 4 lesson. That three-way handshake opens one trip.
The window is bigger than that. It can stay open across many trips, and it is still there when each trip ends.
Think of being logged in to a website. While you click around, your browser opens and closes connections to the server all the time, and you stay logged in. That is the window. The connections come and go. The session stays.

The window has two more jobs, both for long conversations.
First, checkpoints. Sending something big takes time, and roads break. So every so often the two houses agree a marker: "we've got up to here." If the window is interrupted, they pick up from the last marker, not from the beginning. Engineers call this synchronisation. If you have ever watched a download resume instead of restarting, you have felt the idea.
Second, taking turns. Some conversations let both sides talk at once. Others work like a walkie-talkie: one talks, the other waits, then they swap. The window keeps that order, so the houses don't shout over each other. This is dialogue control, and the two styles are full-duplex (both at once) and half-duplex (one at a time).
Careful: the Layer 1 lesson used the same two words for cables. Same idea, different place: here it is the conversation, not the wire.

Layer 5 feels abstract until you watch one phone call.
When your desk phone calls another, three separate things happen. The ringing, the answering and the hanging up are the window: open, maintain, close. The voice itself is a stream of bullhorn shouts riding UDP, because on a live call late is worse than lost. And the voice travels in a separate lane, through different doors, from the messages that set the call up.
The window's real name here is SIP, the Session Initiation Protocol. Its messages have plain-English names:
At the end of the call comes BYE, a final OK, and the window closes.
Because the call setup and the voice are separate, they can break separately. A call can ring, connect, and have no audio at all: the window opened, but the voice lane is blocked. Or, like our user, the voice is perfect and the call still drops: the voice lane is fine, and the window is broken.
| In Byte City | Real name |
|---|---|
| The delivery window | A session |
| Opening the window | Session establishment |
| Keeping it open | Session maintenance |
| Closing it properly | Session termination |
| The checkpoint marker | Synchronisation point |
| Taking turns | Dialogue control (half-duplex / full-duplex) |
| The call setup | SIP, the Session Initiation Protocol |
For the exam, the protocols filed under Layer 5 are SIP, NetBIOS, RPC (remote procedure call) and PPTP, an old VPN protocol.
Now the honest footnote. The OSI model lesson said OSI lost as a design and won as a language, and Layer 5 is where you see that most clearly. Real networks have no separate session box in the wiring. The window's jobs are real, but they are done inside the applications and the libraries they use. Layer 5 is a job description, not a machine.
When someone says "that's a session problem", they mean the deliveries work and the conversation doesn't.

Every phone system keeps a call log. This is our user's call. The INVITE goes out. Ringing comes back. Then OK: the far end picked up. The RTP line shows the voice flowing on its own lane.
Now look at what is missing. After OK, the caller's phone is supposed to send ACK: "I heard you pick up." It never arrives. So the far end sends OK again. And again. After thirty-two seconds it gives up, sends BYE, and hangs up. The window was never properly opened, so it was closed.
Where did the ACK go? A firewall between the two offices had a rule for the voice lane and a rule for the first messages of the call, and it silently dropped that one message. Every delivery worked. The conversation didn't. Add a rule that lets the call-setup messages through in both directions, and the calls stay up.
The tip: when voice works and calls still drop, or calls connect and nobody can hear anything, stop looking at the road. Look at the window. Voice over IP gets a complete lesson of its own.
For the Network+ exam: which OSI layer is responsible for opening, maintaining and closing the dialogue between two applications? Layer 5, Session. Layer 4 gets one delivery there. Layer 5 runs the conversation. Note the port in the log too: SIP call setup uses 5060, or 5061 when it is encrypted with TLS.

You use windows all day without seeing them. Staying logged in to a website is a session. Opening a file on the office server, the one down the hall from the Layer 3 lesson, is a session. A remote desktop is a session.
And every window has a clock. If one side vanishes, say a laptop lid is closed or a cable pulled, the other side can't wait forever. After a quiet spell, the window is closed from one end. That is a timeout, and it is why a remote desktop kicks you off after lunch.
It is also why some applications send a small "still there?" every minute or so. That is a keep-alive: it stops a quiet conversation being mistaken for a dead one.
It opens, maintains and closes the conversation between two applications. It also sets checkpoints so an interrupted exchange can resume, and controls whose turn it is to talk.
A connection, such as one TCP connection, carries one exchange. A session is the whole conversation and can outlive many connections, which is how you stay logged in to a website.
Usually because the ACK that confirms the call never reaches the far end. The far end keeps resending OK, gives up after 32 seconds and hangs up. A firewall silently dropping the ACK is a common cause.
SIP, the Session Initiation Protocol, sets up and ends calls with messages such as INVITE, RINGING, OK, ACK and BYE. The voice itself travels separately, over UDP.
For the Network+ exam: SIP, NetBIOS, RPC and PPTP.
Five questions on this lesson. Pick an answer to see why.
Previous
Numbered doors, the truck that calls ahead and the bullhorn that doesn't.
Next
The packing room: the label printer, the vacuum sealer and the lock on door 443.
Related
A city, seven floors, and why the model lost as a design and won as a language.
Exam objectives: CompTIA Network+ N10-009: 1.1 (OSI model, Layer 5), 1.4 (SIP 5060/5061), 5.3 (VoIP troubleshooting), 5.5 (reading logs).
Byte City is not affiliated with or endorsed by CompTIA.