UDP
- Source port, destination port
- Length
- Checksum
- Add all 16 bit integers
- Drop overflow
- Flip bits
TCP
- Point-to-point
- Reliable, in-order
- Full duplex (bi-directional)
- Connection oriented
- Flow control
Structure
- 20 byte basic header
- source, dest port
- sequence number
- acknowledgement number
- etc.
Reliable Data Transfer (rdt
)
- Single sender, receiver
- Various misbehaviors
- Data corruption
- Data lost
- Out-of-order
- Duplicate copies
- Long delayed delivery
- Develop sender, receiver
- Consider only unidirectional
- States, actions
- RDT 1.0, assuming reliable channel
- RDT 2.0, channel with bit errors
- How to detect/recover from errors?
- Checksum
- ACK (packet received)
- NAK (packet not recieved)
- Send retransmits upon NAK
- But what if ACK or NAK are corrupted?
- We don’t know whether to retransmit or not
- Solution: SEQ
- 1 bit SEQ is enough (0 again, 1 new)
- NAK-free: send ACK for last received packet
- RDT 3.0, channel with bit errors and loss
- Just timeout, resend
- What if duplicate (just heavily delayed), SEQ takes care