TCP and UDP
- transmission control protocol
- user datagram protocol
When data is transmitted, it's divided into packets and there's a chance of packet loss during this process
TCP
- ensures that these lost packets are reliably delivered
- accomplishes this by setting up a two-way connection between the devices in communication(commonly referred to as a 3-way handshake)
- requires that both client and server establish reliable connection before data exchange
- TCP is distinguished by its RELIABILITY
Process (re-transmission of loss packets):
- once two-way connection is established, bidirectional communication can begin
- if data packet is sent and doesn't receive an acknowledgement, TCP assumes it wasn't received and truggers a retransmission
3-way handshake
- client tries to sync with server
- Server replies with acknowledgement and tries to sync with client
- Client sends acknowledgement to server
TCP is expensive and has a lot of overhead, reliability in exchange for speed
UDP
- no guarantee of completeness and order of data transfer
- a lot faster than TCP, in exchange for reliability
- useful for live streaming / smoother gameplay (when speed and efficiency of data is more important than reliability and error correction)