cs241: transport layer

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/59

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

60 Terms

1
New cards

What is the main responsibility of the Transport Layer?

It provides logical communication between application processes on different hosts. Transport layer can compensate for unreliability in TCP or UDP in network layer. Transport layer features include: resending lost packets, encryption, ordering

  • handles segmentation, reassembly, error recovery, flow control, and sometimes congestion control.

2
New cards

How does the Transport Layer differ from the Network Layer?

Transport layer delivers data to the correct application, while the network layer delivers data to the correct host.

Network Layer (IP)

Transport Layer (TCP/UDP)

·        Moves data from one host to another.

·        Like the postal service, it’s responsible for:

o   Routing the data through routers (mail centers).

o   Making sure it gets from one address to another.

·        Routers operate here and don't care what's inside the data — just where it’s going.

·        Operates only in end systems (hosts).

·        Responsible for getting data to the right application on the host.

o   Collects data from the sender’s processes

o   Delivers it to the correct process on the receiving host

 

3
New cards

What are the two main protocols in the Transport Layer?

TCP and UDP.

4
New cards

What does the transport layer provide?

Logical communication between app processes running on different hosts.

5
New cards

Where do transport protocols run?

In end systems only; routers do not run transport protocols.

6
New cards

What happens on the send side of the transport layer?

Takes data from the app, segments it, adds a header (with port numbers), and passes it to the network layer (IP).

7
New cards

What happens on the receive side of the transport layer?

Reassembles segments into messages and delivers them to the correct application process.

8
New cards

What kind of delivery does IP provide?

Best-effort delivery (no guarantees for delivery, order, or correctness).

9
New cards

What is multiplexing at in transport protocols?

(at sender) The process of gathering data from multiple applications and sending them with unique port numbers.

10
New cards

What is demultiplexing in transport protocols?

(at receiver) The process of delivering received data to the correct application using port numbers.

11
New cards

What is UDP?

A lightweight, connectionless protocol providing fast transmission with no reliability guarantees.

  • lightweight and fast

  • no reliability mechanisms

  • connection-less

  • no congestion control

12
New cards

Why is UDP good for video streaming?

It's loss-tolerant and does not introduce delay with retransmissions.

13
New cards

How do you create a UDP socket in Python?

clientSocket = socket(AF_INET, SOCK_DGRAM)

14
New cards

What is TCP?

A connection-oriented protocol that provides reliable, ordered, and error-checked delivery.

15
New cards

What makes TCP reliable?

Sequence numbers, acknowledgements, retransmissions, congestion control. In the Internet, packets can be lost, get corrupted, and can arrive out of order, TCP makes sure none of these is perceived by the application processes and flow control.

16
New cards

What is TCP flow control?

A mechanism to ensure the sender does not overwhelm the receiver.

17
New cards

What is the 'receive window' in TCP?

The buffer space the receiver advertises to the sender.

18
New cards

What is TCP congestion control?

A mechanism to prevent the network from becoming overloaded.

19
New cards

What does AIMD stand for in TCP?

Additive Increase, Multiplicative Decrease.

20
New cards

What is the initial phase of TCP congestion control?

Slow Start.

21
New cards

What happens during TCP Slow Start?

Congestion window (cwnd) increases exponentially.

22
New cards

When does TCP switch from Slow Start to Congestion Avoidance?

When cwnd reaches the threshold (ssthresh) or packet loss occurs.

23
New cards

What is Fast Retransmit in TCP?

Re-sending a packet after receiving 3 duplicate ACKs without waiting for a timeout.

24
New cards

What is the four-tuple used to identify a TCP connection?

Source IP, source port, destination IP, destination port.

25
New cards

What does 'full-duplex' mean in TCP?

Data can flow in both directions at the same time.

26
New cards

What is the difference between Stop-and-Wait and Pipelining?

Stop-and-Wait sends one packet at a time, Pipelining allows multiple in-flight packets.

27
New cards

What is Go-Back-N protocol?

A pipelining protocol where the sender can send multiple packets but must resend from a lost packet onward.

28
New cards

What is Selective Repeat protocol?

A pipelining protocol where only the lost packet is resent, not all subsequent packets.

29
New cards

What is the Alternating Bit Protocol?

A Stop-and-Wait protocol with a 1-bit sequence number to detect duplicates.

30
New cards

What is the Delay-Bandwidth Product?

The amount of data that can be in flight at one time, calculated as link rate × RTT.

31
New cards

What is rdt1.0?

A reliable data transfer protocol over a perfect channel — no errors or loss.

32
New cards

What improvements does rdt2.0 add?

Error detection and ACK/NAK feedback.

33
New cards

What problem does rdt2.1 solve?

Corrupted ACK/NAK messages using sequence numbers.

34
New cards

What improvement does rdt3.0 make over rdt2.2?

It adds a timer to detect and recover from lost packets.

35
New cards

Why are sequence numbers important?

They help detect duplicates and ensure correct order of packets.

36
New cards

What is TCP's retransmission strategy?

It uses cumulative ACKs and retransmits only the segment that timed out.

37
New cards
What does AF_INET and SOCK_DGRAM specify?
IPv4 addressing and UDP protocol.
38
New cards
How are ports assigned automatically in UDP?
OS assigns a dynamic port in the range 1024–65535 if none is specified. this is when client doesn't need a specific port number just one for their connection.
39
New cards
How do you manually assign a port to a UDP socket in Python?
clientSocket.bind(("", port_number)) — e.g., 19157.
40
New cards
Why is manual port assignment important?
For servers or well-known services where clients expect a specific port.
41
New cards
What are the benefits of using UDP?
Fast, low-overhead communication with no connection setup, smaller header size.
42
New cards
How can reliable transfer be achieved over UDP?
By adding reliability at the application layer.
43
New cards
What information does a UDP header contain?
Source port number and destination port number.
44
New cards
What does UDP multiplexing do at the sender?
Takes application data, wraps it with a header, and sends it to the network layer.
45
New cards
What does UDP demultiplexing do at the receiver?
Looks at the destination port to deliver the segment to the correct socket.
46
New cards
Why is the destination port key in UDP?
Because multiple processes may use different sockets; the port ensures correct delivery.
47
New cards
What uniquely identifies a TCP socket?
A four-tuple: (source IP, source port, destination IP, destination port)
48
New cards
Why does TCP use a four-tuple to identify sockets?
To distinguish connections even if clients connect to the same server port or use the same source port. TCP uses all four fields to deliver a segment to the correct socket.
49
New cards
Why are all four fields of the TCP four-tuple needed?
Because different clients can connect to the same port or reuse the same source port — IPs differentiate them.
50
New cards
Where are the TCP four-tuple fields found?
In the TCP segment header and the IP datagram.
51
New cards
How does a TCP client establish a connection?
It creates a socket and sends a segment with the destination port, random source port, and a SYN flag.
52
New cards
What Python function creates a TCP socket on the client side?
clientSocket = socket(AF_INET, SOCK_STREAM)
53
New cards
What Python function is used to initiate a connection to a server in TCP?
clientSocket.connect((serverName, 12000))
54
New cards
What is sent in the initial TCP segment from the client?
Destination port, randomly chosen source port, SYN flag.
55
New cards
What is a SYN flag used for in TCP?
To initiate connection establishment.
56
New cards
What does the server use to listen for incoming TCP connections?
A welcoming (listening) socket bound to a known port (e.g., 12000).
57
New cards
What happens when a TCP server receives a connection request?
It creates a new socket specifically for that client connection.
58
New cards

What Python function is used to accept a client connection on the server side?

connectionSocket, addr = serverSocket.accept()

59
New cards

How does TCP multiplexing work?

1.        Multiple application processes (like web browsers, email clients, file transfer apps) on the same host want to send data.

2.        Each application has its own TCP socket with a unique 4-tuple:

(source IP, source port, destination IP, destination port)

3.        The TCP layer:

-            Tags each segment with the correct source and destination port numbers.

-            Uses the 4-tuple to manage multiple active connections at once.

4.        It passes the segment to the network layer, which encapsulates it in an IP datagram and forwards it toward the destination.

60
New cards