Transport Layer ll Flashcards
What is TCP?
A connection-oriented transport protocol providing reliable, in-order and flow-controlled data delivery between processes on different hosts
How is a TCP connection identified?
By a 4-tuple: source IP, source port, destination IP, destination port
What are key fields in a TCP header?
- Sequence/Ack numbers: For reliable data transfer
- 16-bit receive window: For flow control
- Flags (SYN, ACK, FIN, RST): Connection management
- Checksum: Error detection
How is the MSS determined?
MSS = MTU (link layer frame size) - TCP/IP header (40 bytes)
Describe the 3-way handshake
- Client -> Server: SYN (seq=client_isn)
- Server -> Client: SYN-ACK (seq=server_isn, ack=client_isn+1)
- Client -> Server: ACK (ack=server_isn+1)
How is a TCP connection terminated?
- One host sends FIN, other ACKs
- Other host sends FIN, first host ACKs
- Wait for timeout (2*MSL) to ensure all segments die
How does TCP ensure reliability?
- Sequence numbers: Track byte stream
- Cumulative ACks: Ack next expected byte
- Retransmissions: On timeout or 3 duplicate ACKs (fast retransmit)
What triggers fast retransmit?
Receiving 3 duplicate ACKs for the same segment
What is the receive window (rwnd)?
Available buffer space at receiver: rwnd = rcvBuffer - (lastByteRcvd - lastByteRead)
How does the sender avoid overflow?
Sends only up to min(cwnd, rwnd) unacknowledged bytes
How does TCP detect congestion?
Packet loss (timeout/duplicate ACKs) or delayed ACKs
What is AIMD?
Additive Increase: Increase cwnd by 1 MSS/RTT
Multiplicative Decrease: Halve cwnd on loss
When to use UDP over TCP?
For real-time apps (low latency, tolerant to loss), no connection overhead or many clients
Key trade-offs
- UDP: No reliability/flow control, low overhead
- TCP: Reliable but slower (handshake, congestion control)