CS331 / Slide Breakdowns
Upgraded Study Guide

Transport Layer

A complete guide to process-to-process delivery, port numbers, socket addresses, multiplexing, congestion concepts, TCP reliability, UDP simplicity, and when each protocol fits.

Source focusTransport Layer
Exam skillCompare TCP and UDP
Memory hookIP finds host; port finds process
Best useUse for TCP sequence/ACK questions
Services

Transport-Layer Services

The transport layer is between application and network layers. It creates logical communication between processes running on different hosts.

Host vs process

What transport adds

The network layer gets a packet to the destination host. The transport layer gets data to the correct process on that host.

Duties

Main responsibilities

Transport duties include process-to-process communication, port addressing, encapsulation/decapsulation, multiplexing/demultiplexing, connection service choice, and sometimes flow/error control.

Logical connection

End-to-end view

The transport layer creates the appearance of a logical connection between application processes even though packets travel through lower layers and routers.

Mini summary
  • Transport delivers to processes.
  • Ports identify applications.
  • Network layer only reaches the host.
Ports

Ports, Sockets, And Connection Identity

Port numbers solve the problem of multiple processes using the network on the same host.

Port range

16-bit integers

Port numbers range from 0 to 65535. Well-known ports from 0 to 1023 are assigned and controlled by IANA.

Socket

IP address + port

A socket address combines an IP address and a port number. It identifies one process endpoint.

Unique TCP connection

Four values

A TCP connection is identified by source IP, source port, destination IP, and destination port. Different source ports allow the same client to open multiple sessions to the same server.

Mini summary
  • Ports are 16-bit process identifiers.
  • Socket = IP + port.
  • TCP sessions are identified by endpoint pairs.
Handling

Encapsulation, Multiplexing, Demultiplexing

The transport layer packages application messages and sorts traffic from many processes.

Encapsulation

Sender side

The transport layer takes an application message, adds a transport header, and creates a segment or datagram.

Decapsulation

Receiver side

The receiver removes the transport header and delivers the message to the process identified by the port number.

Mux/Demux

Many-to-one and one-to-many

Multiplexing combines data from multiple processes downward. Demultiplexing separates incoming data upward to the right process.

Mini summary
  • Transport adds/removes headers.
  • Ports enable demultiplexing.
  • Multiple apps can share network service.
Service types

Connectionless vs Connection-Oriented

Transport protocols can choose speed and simplicity or reliability and control.

Connectionless

UDP-style service

Segments are independent. There is no handshaking, no flow control, and no error control in the basic UDP service.

Connection-oriented

TCP-style service

A connection is established before data transfer and terminated afterward. Segments belong to a relationship, enabling reliability.

Flow/congestion

Different protections

Flow control prevents sender from overflowing receiver buffers. Congestion control reduces load when the network capacity is exceeded.

Mini summary
  • UDP is connectionless.
  • TCP is connection-oriented.
  • Flow and congestion control solve different problems.
TCP

TCP Reliability: Sequence, ACK, Handshake, Window

TCP is used when reliable ordered delivery matters more than low overhead.

Properties

TCP is reliable and connection-oriented

TCP establishes and terminates connections, numbers bytes, acknowledges received data, retransmits missing data, and uses buffers/windows to handle different sender and receiver rates.

Sequence numbers

Byte numbering

TCP sequence numbers are assigned to individual bytes, not just segments. If a segment starts at byte 8001 and carries 1000 bytes, it covers 8001 through 9000.

ACK numbers

Next byte expected

The acknowledgment number is the next byte expected. After receiving bytes 8001-9000, ACK = 9001.

Three-way handshake

SYN, SYN+ACK, ACK

The client sends SYN, the server replies SYN+ACK, and the client replies ACK. Then data transfer can begin.

Sliding window

Flow control

The receive window tells the sender how much data can be sent before waiting for acknowledgment, preventing receiver-buffer overflow.

Mini summary
  • TCP is reliable and connection-oriented.
  • Sequence numbers count bytes.
  • ACK is next expected byte.
  • Windows support flow control.
UDP

UDP Simplicity And Applications

UDP is useful when the application values speed, low overhead, or real-time behavior more than built-in reliability.

Properties

No handshaking

UDP is connectionless. Each segment is handled independently. There is no built-in flow control, error control, or ordered delivery.

Good fit

DNS and multimedia

DNS often sends one short request and expects one quick response, so UDP fits. Real-time audio/video can tolerate small loss better than retransmission delay.

Bad fit

Exact large transfers

Applications that cannot tolerate loss, errors, or out-of-order arrival should not rely on UDP alone. Examples include large file downloads or e-mail delivery style reliability.

Concept Meaning Exam clue
TCP Reliable, ordered, connection-oriented HTTP/file transfer/e-mail style reliability
UDP Connectionless, independent, low overhead DNS, streaming, real-time apps
ACK TCP acknowledgment Next expected byte
Mini summary
  • UDP is lightweight.
  • It fits short request-response and real-time uses.
  • It is unsuitable for exact reliable transfers unless the application adds reliability.
Revise

Final Cheat Sheet

Use this as the last-pass memory page before a quiz or exam.

  • Transport layer Process-to-process communication.
  • Port 16-bit process identifier.
  • Well-known ports 0-1023.
  • Socket IP address + port.
  • TCP connection Source/destination IP and port pair.
  • Multiplexing Many app streams downward.
  • Demultiplexing Incoming data to right process.
  • TCP Reliable, connection-oriented.
  • Sequence number Byte number.
  • ACK Next expected byte.
  • UDP Connectionless, low overhead.
  • DNS Common UDP use case.
Practice

Practice Questions With Answers

These questions target the facts, comparisons, and calculations that are easiest to test.

What does the port number identify?

Answer: The process/application on a host.

Explanation: IP finds the host; port finds the process.

What are the three steps of TCP connection establishment?

Answer: SYN, SYN+ACK, ACK.

Explanation: That is the three-way handshake.

If TCP receives bytes 1001-2000, what ACK is sent?

Answer: 2001.

Explanation: ACK is the next expected byte.

Why is UDP suitable for DNS?

Answer: DNS is usually a short request and quick response.

Explanation: UDP avoids connection setup overhead.

Why is UDP not suitable for downloading a huge exact file?

Answer: It has no built-in reliability or ordering.

Explanation: Loss or out-of-order arrival would corrupt the transfer unless handled elsewhere.