Understanding the Differences Between TCP and UDP
- Networks communicate in Layers.
- This is handled in Layer 4, Transport Layer
- TCP is “Reliable”
- Reliable – Uses Acknowledgements
- Builds Connections with system it is communicating with
- Uses Sequence Numbers – Every packet is tagged with a # to know the order the packets had been sent.
- UPD is “Unreliable”
- No Acknowlegements. Data sent, but never verified.
- Connectionless
- Best-Effort Delivery – You send it and hope it gets there, no guarantee
- Good for “Real Time” data – VoIP, Online Gaming, Video Streaming, etc.
The TCP Three-Way Handshake
This happens everytime a new session is started.
- Sender sends a “SYN” Request
- Receiver receives the “SYN” request and responds with a “SYN-ACK” (Syncronize Acknowledgement)
- Sender replies with “ACK” and packet sending can begin.
TCP Sequence Numbers and Acknowledgements
In this example: Each server has its own set of sequence numbers.
- Sender sends with SEQ 10
- Receiver replies, SEQ 5, ACK 11 (ACK is always Receiving SEQ+1): “I received SEQ 10 and waiting for SEQ 11”
- Sender sends SEQ 11, ACK 6
- Receiver replies SEQ 6, ACK 12
IF Sender Packet SEQ 11 fails to reach Receiver:
- Receiver will not receive ACK 6, so it will resend SEQ 5 after timeout
- Sender will receive ACK 11, so will resend SEQ 11
TCP Windowing
a.k.a. Sliding Window size because the window size varies.
This system is used to allow the sending server to send increasingly more packets with every “group”. This is more efficient than sending each packet and waiting for an ACK. The number of packets will double with each successful send until a failure occurs.
** Actual Sequence Numbers refer to the number of bytes being sent.


