Network Protocols
Network protorols are rules about how data is formatted and transmitted over a network. Largely, there are TCP and UDP protocols.
TCP
- Transmission Control Protocol
- Connection-based protocol
- Reliable
- Relatively slower than UDP
- Establishes a secure connection between sender and receiver and send messages. When a message is sent, the receipt is verified to ensure all the data was transferred.
- Able to send data in a sequence.
- Can retransmit data if packets failed to be delivered
- ex: email/text messaging, Streaming such as pre-recorded content like Netflix, general web browsing
How it works
- Three-way handshake (a three-step process)
- The client device initiates the data transfer sends a sequence number (
SYN
) to the server. It tells the server the number that data transfer should begin with - The server acknowledges the client
SYN
when it receives and sends its ownSYN
number. This step is known asSYN-ACK
(SYN acknowledgement) - The client acknowledges (
ACK
) the server’sSYN-ACK
and forms a direct connection with the server and begin the data transfer.
Whenever a data packet is sent, TCP protocl requires an acknowledgement from the receiver. If it does not receive acknowledgement, the data packet will be re-sent.
Similarly, if there is an error during data packet delivery and is acknowledged, the sender will send a new data packet for it.
UDP
- User Datagram Protocol
- Connectionless
- Less reliable
- Relatively faster than TCP
- It sends data without an established connection. When sending data, it does not confirming receipt or errors. Some or all data may be lost.
- Cannot retransmit data even if data packets may be lost
- Most VPNs run on UDP protocols to keep connection speed high
- ex: Online gaming, video chatting, DNS (Domain Name System)
How it works
- Immediately sends data to the receiver who requested a data transmission.
- Sometimes called as
Fire-and-Forget
protocol as UDP protocol does not confirm whether the data packets are delivered successfully or not.