Transport layer and Network layer’s interfacing
Transport layer (UDP, TCP): logical communication between processes
Network layer (IP): logical communication between hosts
Only adds on top of IP:
Is unreliable, and to achieve reliable UDP transmission, application implements error detection/recovery.
Multiplexing: method via which analog/digital signals combine into one signal over shared medium.
Demultiplexing: opposite process that separates signals.
For the server, a single port serves every client. UDP’s segment includes:
To detect errors in the segment.
Important: UDP Checksum is performed over entire payload AND other header fields (source IP, dest IP, length)
Computation:
Note: even if the checksum + sum = 111…1, there could still be some error in the packet.
Application layer assumes the underlying transport layer is reliable.
The transport layer’s service is to provide reliable data transfer (rdt) via the underlying unreliable network layer.
rdt_send()
: Application $\rightarrow$ Transport layer (Sender)udt_send()
: Transport $\leftrightarrow$ Network layer (Sender)
rdt_send
to send to networkrdt_rcv()
: Transport $\leftrightarrow$ Network layer (Receive)deliver_data()
: Application $\leftarrow$ Transport (Receive)
rdt_rcv
to deliver to appAssumption: Underlying channel is perfectly reliable
New Limitation: Underlying channel may have bit errors
Checksum to detect errors. Then the receiving side (via network) informs sender either:
New Limitation: ACK/NAK itself can be corrupted
Sender state diagram:
Receiver state diagram:
New Limitation: Eliminate need for NAK
Solution: Instead of NAK, receiver explicitly includes sequence number of last ACKed packet.
Duplicate ACK at sender will result in retransmission of current packet.
New Limitation: Underlying channel also can lose whole packets (data, ACKs)
Approach: Sender has a timeout for ACK. Retransmit if no ACK received within this time.
What if ACK is delayed but not lost? Duplicate ACK handling handled by sequence numbers.
Note that the timeout + seuqence number handles multiple cases without differentiating them
Very bad because of poor utilization (too much waiting).
$D_\text{trans} = L/R = 1KB / (10^9 \text{ bits}/s) = 8 \text{ms}$
$U_\text{sender} = \frac{D_\text{trans}}{RTT + D_\text{trans}}$ is very small when $RTT » D_\text{trans}$.
Sender sends multiple “in-flight” packets at once, so range of sequence numbers must be increased.
$U_\text{sender} = \frac{kD_\text{trans}}{RTT + D_\text{trans}}$ utilization for $k$-packet pipeline
We have a sliding window for the range of sequence numbers for the inflight packets.
When a new ACK is received, move forward the sliding window.
On duplicate ACKs (NAK), sender ignores the ACK, and receiver discards all packets with sequence numbers $\neq$ latest ACK sequence number + 1. After a timeout sender sends again from latest ACK + 1. [Goes back to the last N]
Receiver maintains a cumulative ACK.
No need for a buffer as all out of order packets are discarded
Pros: Simple implementation of receiver
Cons: Inefficient due to discarding packets (if pipeline bigger, worse efficiency as likely to cause more discarded packets)
Receiver individually acknowledges all received packets. Out of order packets are buffered.
SR sender:
send_base
= ACK, send_base
is moved forward to unACKed packet with smallest sequence numberSR receiver:
rcv_base+1, rcv_base+N-1
]: Buffered, not sent up.rcv_base
: Sent up with all subsequent buffered packets until first unreceived. Sliding window is moved by number of packets sent up.Pros: Less wasted transmissions
Cons: Much more complicated receiver