CS331 · Chapter 9 · Annotated SlidesTransport Layer
Original
Overview

Transport Layer

Process-to-process delivery: port numbers and socket addresses, multiplexing, connectionless vs. connection-oriented service, and the two protocols. TCP gets the detail (sequence and acknowledgment numbers, the three-way handshake, termination, windows); UDP gets the “when is it the right choice” scenarios. Sequence/ACK arithmetic and TCP-or-UDP scenarios are the usual questions.

How to read this page

Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.

All 50 slides
  1. 1 Transport Layer
  2. 2 Chapter 9: Outline
  3. 3 9-1 TRANSPORT LAYER SERVICES
  4. 4 Logical connection at the transport layer (Figure 9.1)
  5. 5 Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)
  6. 6 Transport layer duties
  7. 7 9.1.1 Process-to-Process Communication
  8. 8 Network layer versus transport layer (Figure 9.2)
  9. 9 PROCESS-TO-PROCESS Communication
  10. 10 Addressing – Port numbers
  11. 11 Some well-known ports used with UDP and TCP
  12. 12 Port numbers
  13. 13 Addressing – Socket Address
  14. 14 Socket address (Figure 9.6)
  15. 15 IP addresses versus port numbers (Figure 9.4)
  16. 16 Same client to same server: different source ports, same destination port
  17. 17 Two clients contact the same server with the same port numbers
  18. 18 9.1.3 Encapsulation and Decapsulation
  19. 19 Encapsulation and decapsulation (Figure 9.7)
  20. 20 9.1.4 Multiplexing and Demultiplexing
  21. 21 Multiplexing and demultiplexing (Figure 9.8)
  22. 22 Congestion Control
  23. 23 Connection
  24. 24 Connection
  25. 25 Connectionless service (Figure 9.14)
  26. 26 Connection-oriented service (Figure 9.15)
  27. 27 Flow control and Error Protocols
  28. 28 Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)
  29. 29 Transmission Control Protocol (TCP)
  30. 30 TCP segment format (Figure 9.23)
  31. 31 Control flags (Figure 9.24)
  32. 32 TCP segments (Figure 9.22)
  33. 33 TCP Sequence Number
  34. 34 Example 9.8: sequence numbers
  35. 35 TCP Connection
  36. 36 Connection establishment using three-way handshaking (Figure 9.26)
  37. 37 Reliable Delivery
  38. 38 Data transfer example (See Next Slide for explanation)
  39. 39 Data transfer example
  40. 40 Connection termination
  41. 41 Flow Control
  42. 42 TCP windows (initial window sizes)
  43. 43 TCP Applications
  44. 44 User Datagram Protocol (UDP)
  45. 45 UDP Applications
  46. 46 UDP is suitable for applications that makes one request
  47. 47 UDP is NOT suitable for applications that do not tolerate loss or errors or out of order arrival
  48. 48 UDP is NOT suitable for applications that do not tolerate loss or errors out of order arrival
  49. 49 UDP is suitable for real time applications
  50. 50 User datagram packet format (Figure 9.18)
Slide 1 / 50

Transport Layer

Slide 1: Transport Layer

Notes

  1. Duties → ports and sockets → mux/demux → connectionless vs. connection-oriented → TCP (sequence numbers, handshake, ACKs, windows) → UDP and when to use it.

Slide 2 / 50

Chapter 9: Outline

Slide 2: Chapter 9: Outline
Slide 3 / 50

9-1 TRANSPORT LAYER SERVICES

Slide 3: 9-1 TRANSPORT LAYER SERVICES

Notes

  1. Transport sits between application and network and gives PROCESS-to-process delivery over a logical connection.

  2. Seen again Ch 1 Part 2, slide 38: Transport layer overview

Slide 4 / 50

Logical connection at the transport layer (Figure 9.1)

Slide 4: Logical connection at the transport layer (Figure 9.1)

Notes

  1. The two transport layers act as if directly connected; the routers in between never look at the transport header.

Slide 5 / 50

Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)

Slide 5: Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)

Notes

  1. Two transport protocols in the course: UDP and TCP.

Slide 6 / 50

Transport layer duties

Slide 6: Transport layer duties

Notes

  1. Seven duties: process-to-process, addressing, encapsulation, mux/demux, connection control, reliability (flow + error), congestion control.

Exam angle

PredictionQ1

Which is NOT a transport-layer duty in the slides?

Slide 7 / 50

9.1.1 Process-to-Process Communication

Slide 7: 9.1.1 Process-to-Process Communication
Slide 8 / 50

Network layer versus transport layer (Figure 9.2)

Slide 8: Network layer versus transport layer (Figure 9.2)

Exam angle

PredictionQ1

Host-to-host delivery is the job of the _ layer; process-to-process delivery is the job of the _ layer.

Slide 9 / 50

PROCESS-TO-PROCESS Communication

Slide 9: PROCESS-TO-PROCESS Communication
Slide 10 / 50

Addressing – Port numbers

Slide 10: Addressing – Port numbers

Notes

  1. Port = 16 bits (0–65,535). Well-known 0–1023 (IANA) → servers. Clients pick a random higher (ephemeral) port.

  2. Memory trick Ports to know: FTP 20/21, Telnet 23, SMTP 25, DNS 53, DHCP 67, HTTP 80.

Exam angle

PredictionQ1

Port numbers are:

PredictionQ2

The well-known port of HTTP is:

PredictionQ3

A client normally uses a well-known port as its source port.

Slide 11 / 50

Some well-known ports used with UDP and TCP

Slide 11: Some well-known ports used with UDP and TCP

Notes

  1. FTP, TELNET, SMTP, HTTP need reliability → TCP only. SNMP → UDP only. DNS uses both (mostly UDP).

Exam angle

PredictionQ1

Which application uses port 25?

PredictionQ2

Which port does DNS use?

Slide 12 / 50

Port numbers

Slide 12: Port numbers

Notes

  1. Request: source 52,000 → destination 13. Reply: the ports swap.

Slide 13 / 50

Addressing – Socket Address

Slide 13: Addressing – Socket Address

Notes

  1. A connection needs four things: local IP, local port, remote IP, remote port.

  2. Memory trick Socket address = WHERE (IP) + WHO (port).

Exam angle

PredictionQ1

A socket address is the combination of:

Slide 14 / 50

Socket address (Figure 9.6)

Slide 14: Socket address (Figure 9.6)
Slide 15 / 50

IP addresses versus port numbers (Figure 9.4)

Slide 15: IP addresses versus port numbers (Figure 9.4)

Exam angle

PredictionQ1

At the receiving host, which field selects the application process?

Slide 16 / 50

Same client to same server: different source ports, same destination port

Slide 16: Same client to same server: different source ports, same destination port
Slide 17 / 50

Two clients contact the same server with the same port numbers

Slide 17: Two clients contact the same server with the same port numbers

Notes

  1. A connection is identified by BOTH socket addresses. Same port 49888 is fine because the source IPs differ.

Exam angle

PredictionQ1

Two laptops, 192.168.1.101 and 172.16.5.5, both open a connection from port 49888 to a web server on port 80. How does the server tell them apart?

Compare with the model answer

Each connection is identified by the full pair of socket addresses (source IP, source port, destination IP, destination port). The source IPs differ, so the two connections are different even though the ports are the same.

Slide 18 / 50

9.1.3 Encapsulation and Decapsulation

Slide 18: 9.1.3 Encapsulation and Decapsulation

Notes

  1. Sender: add the transport header (with the ports). Receiver: strip it and hand the data to the process.

Slide 19 / 50

Encapsulation and decapsulation (Figure 9.7)

Slide 19: Encapsulation and decapsulation (Figure 9.7)
Slide 20 / 50

9.1.4 Multiplexing and Demultiplexing

Slide 20: 9.1.4 Multiplexing and Demultiplexing

Exam angle

PredictionQ1

Demultiplexing at the transport layer happens at the:

Slide 21 / 50

Multiplexing and demultiplexing (Figure 9.8)

Slide 21: Multiplexing and demultiplexing (Figure 9.8)
Slide 22 / 50

Congestion Control

Slide 22: Congestion Control

Notes

  1. Trap Flow control protects the RECEIVER; congestion control protects the NETWORK.

  2. Seen again Ch 3 Part 1, slide 5: Flow control at the data link layer

Exam angle

PredictionQ1

Keeping the load on the network below its capacity is:

Slide 23 / 50

Connection

Slide 23: Connection
Slide 24 / 50

Connection

Slide 24: Connection

Notes

  1. TCP (connection-oriented): set up first, both sides agree, in-order delivery, flow + error + congestion control, then close.

Exam angle

PredictionQ1

Compare connectionless (UDP) and connection-oriented (TCP) transport services.

Compare with the model answer

Connectionless (UDP): each segment is independent, no connection setup, no flow, error or congestion control. Connection-oriented (TCP): a logical connection is set up with both sides agreeing before data is sent, segments are delivered in order, flow, error and congestion control are applied, and the connection is closed afterwards.

PredictionQ2

UDP provides flow and congestion control.

Slide 25 / 50

Connectionless service (Figure 9.14)

Slide 25: Connectionless service (Figure 9.14)
Slide 26 / 50

Connection-oriented service (Figure 9.15)

Slide 26: Connection-oriented service (Figure 9.15)

Notes

  1. Connection-oriented: open → data (out-of-order segments held and reordered) → teardown.

Slide 27 / 50

Flow control and Error Protocols

Slide 27: Flow control and Error Protocols
Slide 28 / 50

Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)

Slide 28: Position of transport-layer protocols in the TCP/IP protocol suite (Figure 9.17)

Notes

  1. Same figure as slide 5.

Slide 29 / 50

Transmission Control Protocol (TCP)

Slide 29: Transmission Control Protocol (TCP)

Exam angle

PredictionQ1

The default TCP header size is:

Slide 30 / 50

TCP segment format (Figure 9.23)

Slide 30: TCP segment format (Figure 9.23)

Notes

  1. Ports (16 + 16), sequence (32), ACK number (32), HLEN, flags, window (16), checksum, urgent pointer, options.

Slide 31 / 50

Control flags (Figure 9.24)

Slide 31: Control flags (Figure 9.24)

Notes

  1. SYN = synchronize (open). ACK = acknowledgment valid. FIN = finish (close). RST = reset. PSH = push. URG = urgent.

Exam angle

PredictionQ1

Which TCP flag is used to open a connection?

PredictionQ2

Which flag terminates a connection?

Slide 32 / 50

TCP segments (Figure 9.22)

Slide 32: TCP segments (Figure 9.22)

Notes

  1. Sender and receiver run at different speeds → buffers on both sides; TCP groups bytes into segments.

Slide 33 / 50

TCP Sequence Number

Slide 33: TCP Sequence Number

Notes

  1. Trap Sequence numbers count bytes, not segments.

Exam angle

PredictionQ1

A segment has sequence number 2,001 and carries 500 bytes. The next segment’s sequence number is:

PredictionQ2

TCP sequence numbers count segments.

Slide 34 / 50

Example 9.8: sequence numbers

Slide 34: Example 9.8: sequence numbers

Notes

  1. Add 1,000 each time.

Exam angle

PredictionQ1

A 6,000-byte file starts at byte 1,001 and is sent in 3 equal segments. The third segment’s sequence number is:

Slide 35 / 50

TCP Connection

Slide 35: TCP Connection
Slide 36 / 50

Connection establishment using three-way handshaking (Figure 9.26)

Slide 36: Connection establishment using three-way handshaking (Figure 9.26)

Notes

  1. 2) Server → SYN + ACK: acknowledges, gives its own ISN and its receive window.

  2. Memory trick SYN → SYN-ACK → ACK.

Exam angle

PredictionQ1

The second segment of the three-way handshake has which flags set?

PredictionQ2

The client sends SYN with seq 8000. The server’s SYN+ACK carries ack =

Slide 37 / 50

Reliable Delivery

Slide 37: Reliable Delivery

Notes

  1. ACK number = next byte expected = last byte received + 1. ACKs are cumulative (all bytes up to X - 1).

  2. A timer per segment: no ACK in time → retransmit.

Exam angle

PredictionQ1

A receiver got bytes up to 4,500. It sends ACK number:

PredictionQ2

An ACK number of X means bytes up to X - 1 were received.

Slide 38 / 50

Data transfer example (See Next Slide for explanation)

Slide 38: Data transfer example (See Next Slide for explanation)

Notes

  1. Explained on the next slide. ACKs piggyback on data segments.

Slide 39 / 50

Data transfer example

Slide 39: Data transfer example

Exam angle

PredictionQ1

Client sends seq 8001 (1000 bytes) and seq 9001 (1000 bytes). The server replies with 2000 bytes starting at 15001. Give the server’s ACK number and the client’s final ACK number.

Compare with the model answer

The server acknowledges 10001 (it has bytes up to 10000). Its data covers 15001–17000, so the client acknowledges 17001.

Slide 40 / 50

Connection termination

Slide 40: Connection termination

Notes

  1. Termination: FIN → ACK, then (when the other side is done) FIN → ACK. Half-close in between.

Exam angle

PredictionQ1

After host 1 sends FIN and gets ACK, host 1 can:

Slide 41 / 50

Flow Control

Slide 41: Flow Control

Notes

  1. Window = how much the sender may send before it must wait for an ACK.

Exam angle

PredictionQ1

TCP flow control is done with:

Slide 42 / 50

TCP windows (initial window sizes)

Slide 42: TCP windows (initial window sizes)

Notes

  1. Memory trick You can only send as much as the other side can receive.

Exam angle

PredictionQ1

The server advertises a receive window of 5,000 bytes. The client’s send window is:

Slide 43 / 50

TCP Applications

Slide 43: TCP Applications

Notes

  1. TCP for anything that must arrive complete: web (HTTP), email (SMTP), Telnet, file transfer (FTP).

Exam angle

PredictionQ1

Which application needs TCP?

Slide 44 / 50

User Datagram Protocol (UDP)

Slide 44: User Datagram Protocol (UDP)

Notes

  1. Benefits: simple, small header, no setup delay.

Exam angle

PredictionQ1

When UDP detects an error with its checksum, it asks the sender to retransmit.

PredictionQ2

The UDP checksum is:

Slide 45 / 50

UDP Applications

Slide 45: UDP Applications

Notes

  1. UDP for apps that tolerate a little loss and need speed: multimedia, internet telephony, video conferencing, DNS, audio, some routing protocols.

Slide 46 / 50

UDP is suitable for applications that makes one request

Slide 46: UDP is suitable for applications that makes one request

Notes

  1. One short request + one short reply (DNS) → UDP is perfect: nothing to reorder.

Exam angle

PredictionQ1

Why does DNS use UDP?

Slide 47 / 50

UDP is NOT suitable for applications that do not tolerate loss or errors or out of order arrival

Slide 47: UDP is NOT suitable for applications that do not tolerate loss or errors or out of order arrival

Notes

  1. Long messages (SMTP with attachments) split over many datagrams can arrive out of order → UDP is a bad fit.

Slide 48 / 50

UDP is NOT suitable for applications that do not tolerate loss or errors out of order arrival

Slide 48: UDP is NOT suitable for applications that do not tolerate loss or errors out of order arrival

Notes

  1. Big file download: completeness matters more than delay → TCP.

Exam angle

PredictionQ1

You are downloading a very large text file. TCP or UDP? Why?

Compare with the model answer

TCP. No part of the file may be missing or corrupted, and the delay between parts doesn’t matter because the file is opened only when complete. UDP gives no reliability or ordering.

Slide 49 / 50

UDP is suitable for real time applications

Slide 49: UDP is suitable for real time applications

Notes

  1. Real-time (Skype): resending late frames is worse than skipping them → UDP.

Exam angle

PredictionQ1

A video call app must choose between TCP and UDP. Which, and why?

Compare with the model answer

UDP. Audio and video are sent as a stream of small frames; waiting for a retransmission would break the timing and freeze the call. With UDP a lost or corrupted frame is just skipped, and the brief gap is barely noticed.

Slide 50 / 50

User datagram packet format (Figure 9.18)

Slide 50: User datagram packet format (Figure 9.18)

Exam angle

PredictionQ1

The UDP header length is: