1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
TCP
A connection-oriented transport protocol providing reliable, in-order and flow-controlled data delivery between processes on different hosts
TCP connection identification
By a 4-tuple: source IP, source port, destination IP, destination port
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
MSS determination
MSS = MTU (link layer frame size) - TCP/IP header (40 bytes)
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)
TCP connection termination
One host sends FIN, other ACKs, Other host sends FIN, first host ACKs, Wait for timeout (2*MSL) to ensure all segments die
TCP reliability
Sequence numbers: Track byte stream
Cumulative ACks: Ack next expected byte
Retransmissions: On timeout or 3 duplicate ACKs (fast retransmit)
Fast retransmit trigger
Receiving 3 duplicate ACKs for the same segment
Receive window (rwnd)
Available buffer space at receiver: rwnd = rcvBuffer - (lastByteRcvd - lastByteRead)
Sender overflow avoidance
Sends only up to min(cwnd, rwnd) unacknowledged bytes
TCP congestion detection
Packet loss (timeout/duplicate ACKs) or delayed ACKs
AIMD
Additive Increase: Increase cwnd by 1 MSS/RTT
Multiplicative Decrease: Halve cwnd on loss
UDP over TCP usage
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)