What does the transport layer provide, and where do transport protocols run?
Logical communication between app processes running on different hosts. Transport protocols run in end systems.
What do the send side and receive side of the transport layer do?
Send side: breaks app messages into segments, passes to network layer. Rcv side: reassembles segments into messages, passes to app layer.
Transport layer vs network layer (one line each), with the household analogy.
Network layer: logical communication between hosts (postal service). Transport layer: logical communication between processes (Ann and Bill who demux to in-house siblings); it relies on and enhances network layer services.
Which services are not available from either TCP or UDP?
Delay guarantees and bandwidth guarantees.
Define multiplexing at the sender and demultiplexing at the receiver.
Multiplexing: handle data from multiple sockets, add transport header (later used for demultiplexing). Demultiplexing: use header info to deliver received segments to correct socket.
How does UDP demultiplex?
The host checks the destination port # in the segment and directs it to the socket with that port #.
UDP: what happens to datagrams with the same destination port but different sources?
Datagrams with the same dest. port # but different source IP addresses and/or source port numbers go to the same socket.
How is a TCP socket identified?
By a 4-tuple: source IP address, source port number, dest IP address, dest port number. The receiver uses all four values to direct a segment to the appropriate socket.
Why does a web server have many sockets on port 80?
A server host may support many simultaneous TCP sockets, each identified by its own 4-tuple: web servers have different sockets for each connecting client (and non-persistent HTTP has a different socket for each request).
Describe UDP's service.
"No frills," "bare bones" transport protocol; "best effort" service: segments may be lost or delivered out-of-order; connectionless: no handshaking, each segment handled independently.
What are the uses of UDP?
Streaming multimedia apps (loss tolerant, rate sensitive); DNS; SNMP. Reliable transfer over UDP: add reliability at application layer (application-specific error recovery).
What fields are in the UDP header, and what does "length" count?
Source port #, dest port #, length, checksum. Length is in bytes of the UDP segment, including header.
Why is there a UDP? (four reasons)
No connection establishment (which can add delay); simple: no connection state at sender, receiver; small header size; no congestion control: UDP can blast away as fast as desired.
How is the UDP checksum computed and checked?
Sender: treat segment contents (incl. header) as 16-bit integers; checksum = one's complement sum, put in the checksum field; a carryout from the most significant bit is added to the result. Receiver: compute checksum; if it differs from the field value, error detected; if equal, no error detected (but maybe errors nonetheless).
What determines the complexity of a reliable data transfer protocol?
The characteristics of the unreliable channel.
rdt_send(), udt_send(), rdt_rcv(), deliver_data(): who calls each?
rdt_send(): called from above (e.g., by app). udt_send(): called by rdt to send a packet over the unreliable channel. rdt_rcv(): called when a packet arrives on the rcv-side of the channel. deliver_data(): called by rdt to deliver data to upper layer.
What new mechanisms does rdt2.0 add?
Error detection (checksum) and receiver feedback: control msgs ACK (pkt received OK) and NAK (pkt had errors); sender retransmits pkt on receipt of NAK.
What is rdt2.0's fatal flaw, and how is it fixed?
If ACK/NAK is corrupted, the sender doesn't know what happened at the receiver and can't just retransmit (possible duplicate). Fix: sender retransmits current pkt and adds a sequence number to each pkt; receiver discards duplicate pkts.
Define "stop and wait".
Sender sends one packet, then waits for receiver response.
rdt2.1: why are two sequence numbers enough, and what can't the receiver know?
Two seq #s (0, 1) suffice for stop-and-wait (the state remembers whether 0 or 1 is expected). The receiver can not know if its last ACK/NAK was received OK at the sender.
How does rdt2.2 work without NAKs?
Receiver sends ACK for the last pkt received OK, explicitly including its seq #. A duplicate ACK at the sender results in the same action as a NAK: retransmit current pkt.
What does rdt3.0 assume and add?
Assumes the channel can also lose packets (data, ACKs). Adds a countdown timer: the sender waits a "reasonable" time for an ACK and retransmits if none arrives; duplicates from merely delayed packets are handled by seq #s.
Formula for sender utilization in stop-and-wait; its value for a 1 Gbps link, 8000-bit packets and RTT 30 ms.
U_sender = (L/R) / (RTT + L/R). For 1 Gbps, 8000-bit packet, RTT 30 ms: .008/30.008 = 0.00027 (≈33 kB/sec over a 1 Gbps link).
What is pipelining, and what does it require?
The sender allows multiple, "in-flight", yet-to-be-acknowledged pkts. Requires an increased range of sequence numbers and buffering at sender and/or receiver.
1 Gbps link, 8000-bit packets, RTT 30 ms: how much does 3-packet pipelining improve utilization?
By a factor of 3: U_sender = (3L/R)/(RTT + L/R) = .0024/30.008 = 0.00081.
GBN: meaning of ACK(n), the timer, and timeout(n).
ACK(n) ACKs all pkts up to and including seq # n (cumulative ACK). One timer for the oldest in-flight pkt. timeout(n): retransmit packet n and all higher seq # pkts in the window.
What does a GBN receiver do with an out-of-order packet?
Discards it (don't buffer: no receiver buffering!) and re-ACKs the pkt with the highest in-order seq #.
Selective repeat: ACKs, buffering, timers, and retransmission.
Receiver individually acknowledges all correctly received pkts and buffers them as needed for in-order delivery. Sender has a timer for each unACKed pkt and only resends pkts for which no ACK was received.
GBN vs Selective Repeat on a timeout.
GBN: retransmit all unacked packets (single timer for the oldest). Selective Repeat: retransmit only that unacked packet (timer per packet).
List the properties of TCP.
Point-to-point; reliable, in-order byte stream (no message boundaries); pipelined (congestion and flow control set window size); full duplex data; MSS; connection-oriented (handshaking inits state); flow controlled.
What do the ACK, RST/SYN/FIN flags and the receive window field mean?
ACK: ACK # valid. RST, SYN, FIN: connection estab (setup, teardown commands). Receive window: # bytes rcvr willing to accept.
Define TCP sequence number and acknowledgement number.
Sequence number: byte stream "number" of the first byte in the segment's data. ACK: seq # of the next byte expected from the other side (cumulative ACK).
How does a TCP receiver handle out-of-order segments?
TCP spec doesn't say — up to implementor.
Why must the TCP timeout be neither too short nor too long?
Too short: premature timeout, unnecessary retransmissions. Too long: slow reaction to segment loss. (It must be longer than RTT, but RTT varies — so SampleRTTs are averaged to a "smoother" estimate.)
What three features does TCP use to build rdt on IP, and what triggers retransmissions?
Pipelined segments, cumulative acks, single retransmission timer. Retransmissions are triggered by timeout events and duplicate acks.
TCP receiver: in-order segment with expected seq #, all earlier data already ACKed. Action?
Delayed ACK: wait up to 500 ms for the next segment; if no next segment, send ACK.
TCP receiver: in-order segment arrives while one other segment has an ACK pending. Action?
Immediately send a single cumulative ACK, ACKing both in-order segments.
TCP receiver: out-of-order segment (gap detected), or a segment that fills the gap. Actions?
Gap: immediately send a duplicate ACK, indicating the seq # of the next expected byte. Filling segment: immediately send ACK, provided the segment starts at the lower end of the gap.
What triggers TCP fast retransmit, and what is resent?
Receiving 3 ACKs for the same data ("triple duplicate ACKs"). The sender resends the unacked segment with the smallest seq # without waiting for the timeout.
What is TCP flow control and how does it work?
The receiver controls the sender so the sender won't overflow the receiver's buffer. The receiver advertises free buffer space in the rwnd field; the sender limits unacked (in-flight) data to rwnd, guaranteeing the receive buffer will not overflow.
How is the RcvBuffer size set?
Via socket options (typical default is 4096 bytes); many operating systems autoadjust RcvBuffer.
Why can a 2-way handshake fail?
Variable delays, retransmitted messages (e.g., req_conn(x)) due to message loss, message reordering, and the sides can't "see" each other — leading to e.g. a half open connection with no client, or duplicate data accepted.
Give the three segments of the TCP 3-way handshake with their fields.
1) Client SYN: SYNbit=1, Seq=x. 2) Server SYNACK: SYNbit=1, Seq=y, ACKbit=1, ACKnum=x+1. 3) Client ACK: ACKbit=1, ACKnum=y+1 (may contain client-to-server data).
Define congestion and give its two manifestations.
"Too many sources sending too much data too fast for network to handle" (different from flow control). Manifestations: lost packets (buffer overflow at routers), long delays (queueing in router buffers).
End-end vs network-assisted congestion control. Which does TCP use?
End-end: no explicit feedback from network; congestion inferred from observed loss, delay — the approach taken by TCP. Network-assisted: routers provide feedback (single congestion bit — SNA, DECbit, TCP/IP ECN, ATM — or an explicit rate).
Additive increase and multiplicative decrease in TCP.
Additive increase: increase cwnd by 1 MSS every RTT until loss detected. Multiplicative decrease: cut cwnd in half after loss. (AIMD saw tooth behavior.)
How does TCP slow start grow cwnd?
Initially cwnd = 1 MSS; double cwnd every RTT (by incrementing cwnd for every ACK received) until the first loss event — slow start, but exponential ramp-up.
TCP Reno vs Tahoe: reaction to timeout and to 3 duplicate ACKs.
Timeout: cwnd set to 1 MSS, grows exponentially to threshold, then linearly. 3 dup ACKs (Reno): cwnd cut in half, then grows linearly. Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks).
TCP fairness goal.
If K TCP sessions share the same bottleneck link of bandwidth R, each should have an average rate of R/K.