TCP
Format
TCP Message (Segment) Format
Connection
TCP Connection Establishment Process: The "Three-Way Handshake"
TCP Connection Termination Process: The "Four-Way Handshake"
TCP Connection Establishment and Termination
Basic
- TCP Sequence and Acknowledgment Numbers
- TCP Sliding Windows, with Flow Control, and Congestion Control
Reference
- Understanding TCP Sequence and Acknowledgment Numbers
- TCP SEQUENCE & ACKNOWLEDGEMENT NUMBERS
- Flow Control and Congestion Control in TCP
Features
- Ordered data transfer — the destination host rearranges according to sequence number
- Retransmission of lost packets — any cumulative stream not acknowledged is retransmitted
- Error-free data transfer
- Flow control — limits the rate a sender transfers data to guarantee reliable delivery. The receiver continually hints the sender on how much data can be received (controlled by the sliding window). When the receiving host's buffer fills, the next acknowledgment contains a 0 in the window size, to stop transfer and allow the data in the buffer to be processed.
- Congestion control
UDP
Format
UDP Message Format
UDP vs. TCP
TCP
- Connection based
- Guaranteed reliable and ordered
- Automatically breaks up your data into packets for you
- Makes sure it doesn’t send data too fast for the internet connection to handle (flow control)
- Easy to use, you just read and write data like its a file
UDP
- Easy to use, you just read and write data like its a file
- No guarantee of reliability or ordering of packets, they may arrive out of order, be duplicated, or not arrive at all!
- You have to manually break your data up into packets and send them
- You have to make sure you don’t send data too fast for your internet connection to handle
- If a packet is lost, you need to devise some way to detect this, and resend that data if necessary
Reliable UDP
- UDT(UDP-based Data Transfer Protocol)
- RUDP(Reliable User Datagram Protocol)